Skip to content

Commit

Permalink
Set integration with Blockscout eth bytecode DB endpoint by default, …
Browse files Browse the repository at this point in the history
…replace old UI with new one in docker-compose configs, set default value for port: 4000
  • Loading branch information
vbaranov committed Sep 18, 2023
1 parent af275a2 commit 1d6da1b
Show file tree
Hide file tree
Showing 26 changed files with 276 additions and 879 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ apps/explorer/node_modules
test
.git
.circleci
.vscode
.elixir_ls
erl_crash.dump
logs
apps/*/test
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
elixir 1.14.5-otp-25
erlang 25.3.2.3
nodejs 18.16.1
erlang 25.3.2.6
nodejs 18.17.1
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

### Chore

- [#8478](https://github.com/blockscout/blockscout/pull/8478) - Set integration with Blockscout's eth bytecode DB endpoint by default and other enhancements
- [#8442](https://github.com/blockscout/blockscout/pull/8442) - Unify burn address definition
- [#8321](https://github.com/blockscout/blockscout/pull/8321) - Add curl into resulting Docker image
- [#8319](https://github.com/blockscout/blockscout/pull/8319) - Add MIX_ENV: 'prod' to docker-compose
Expand Down
11 changes: 11 additions & 0 deletions apps/explorer/lib/explorer/repo/config_helper.ex
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ defmodule Explorer.Repo.ConfigHelper do
path_from_env(path)
end

@doc """
Defines http port of the application
"""
@spec get_port() :: non_neg_integer()
def get_port do
case System.get_env("PORT") && Integer.parse(System.get_env("PORT")) do
{port, _} -> port
_ -> 4000
end
end

defp path_from_env(path_env_var) do
if String.ends_with?(path_env_var, "/") do
path_env_var
Expand Down
4 changes: 2 additions & 2 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,10 @@ config :explorer, Explorer.ThirdPartyIntegrations.Sourcify,
repo_url: System.get_env("SOURCIFY_REPO_URL") || "https://repo.sourcify.dev/contracts"

config :explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour,
service_url: System.get_env("MICROSERVICE_SC_VERIFIER_URL"),
service_url: System.get_env("MICROSERVICE_SC_VERIFIER_URL") || "https://eth-bytecode-db.services.blockscout.com/",
enabled: ConfigHelper.parse_bool_env_var("MICROSERVICE_SC_VERIFIER_ENABLED"),
# or "eth_bytecode_db"
type: System.get_env("MICROSERVICE_SC_VERIFIER_TYPE", "sc_verifier")
type: System.get_env("MICROSERVICE_SC_VERIFIER_TYPE", "eth_bytecode_db")

config :explorer, Explorer.Visualize.Sol2uml,
service_url: System.get_env("MICROSERVICE_VISUALIZE_SOL2UML_URL"),
Expand Down
11 changes: 3 additions & 8 deletions config/runtime/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,20 @@ alias Explorer.Repo.ConfigHelper, as: ExplorerConfigHelper
### BlockScout Web ###
######################

port =
case System.get_env("PORT") && Integer.parse(System.get_env("PORT")) do
{port, _} -> port
:error -> nil
nil -> nil
end
port = ExplorerConfigHelper.get_port()

config :block_scout_web, BlockScoutWeb.Endpoint,
secret_key_base:
System.get_env("SECRET_KEY_BASE") || "RMgI4C1HSkxsEjdhtGMfwAHfyT6CKWXOgzCboJflfSm4jeAlic52io05KB6mqzc5",
http: [
port: port || 4000
port: port
],
url: [
scheme: "http",
host: System.get_env("BLOCKSCOUT_HOST", "localhost")
],
https: [
port: (port && port + 1) || 4001,
port: port + 1,
cipher_suite: :strong,
certfile: System.get_env("CERTFILE") || "priv/cert/selfsigned.pem",
keyfile: System.get_env("KEYFILE") || "priv/cert/selfsigned_key.pem"
Expand Down
6 changes: 4 additions & 2 deletions config/runtime/prod.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ alias Explorer.Repo.ConfigHelper, as: ExplorerConfigHelper
### BlockScout Web ###
######################

port = ExplorerConfigHelper.get_port()

config :block_scout_web, BlockScoutWeb.Endpoint,
secret_key_base: System.get_env("SECRET_KEY_BASE"),
check_origin: System.get_env("CHECK_ORIGIN", "false") == "true" || false,
http: [port: System.get_env("PORT")],
http: [port: port],
url: [
scheme: System.get_env("BLOCKSCOUT_PROTOCOL") || "https",
port: System.get_env("PORT"),
port: port,
host: System.get_env("BLOCKSCOUT_HOST") || "localhost"
]

Expand Down
6 changes: 0 additions & 6 deletions deploy/testing/eth-goerli/.sops.yaml

This file was deleted.

158 changes: 0 additions & 158 deletions deploy/testing/eth-goerli/secrets.yaml

This file was deleted.

Loading

0 comments on commit 1d6da1b

Please sign in to comment.