Remove compile-time vars

pull/6954/head
Viktor Baranov 2 years ago
parent 944434363d
commit 44d9562f41
  1. 5
      .github/workflows/e2e-tests.yml
  2. 10
      .github/workflows/publish-docker-image-every-push.yml
  3. 3
      .github/workflows/publish-docker-image-release.yml
  4. 1
      CHANGELOG.md
  5. 3
      apps/block_scout_web/assets/js/lib/add_chain_to_mm.js
  6. 8
      apps/block_scout_web/assets/js/socket.js
  7. 2
      apps/block_scout_web/assets/webpack.config.js
  8. 27
      apps/block_scout_web/config/config.exs
  9. 12
      apps/block_scout_web/lib/block_scout_web/router.ex
  10. 1
      apps/block_scout_web/lib/block_scout_web/templates/layout/app.html.eex
  11. 23
      apps/block_scout_web/lib/block_scout_web/views/api_docs_view.ex
  12. 21
      apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex
  13. 6
      apps/block_scout_web/priv/gettext/default.pot
  14. 6
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
  15. 30
      apps/block_scout_web/test/block_scout_web/views/api_docs_view_test.exs
  16. 6
      apps/explorer/lib/explorer/repo/config_helper.ex
  17. 25
      config/runtime.exs
  18. 3
      docker-compose/docker-compose-no-rust-services.yml
  19. 3
      docker-compose/docker-compose.yml
  20. 3
      docker-compose/envs/common-blockscout.env
  21. 3
      docker/Dockerfile
  22. 9
      docker/Makefile

@ -63,17 +63,12 @@ jobs:
build-args: | build-args: |
CACHE_EXCHANGE_RATES_PERIOD= CACHE_EXCHANGE_RATES_PERIOD=
DISABLE_READ_API=false DISABLE_READ_API=false
API_PATH=
NETWORK_PATH=
DISABLE_WEBAPP=false DISABLE_WEBAPP=false
DISABLE_WRITE_API=false DISABLE_WRITE_API=false
CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER= CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER=
WOBSERVER_ENABLED=false WOBSERVER_ENABLED=false
ADMIN_PANEL_ENABLED=false ADMIN_PANEL_ENABLED=false
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL= CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
DISABLE_BRIDGE_MARKET_CAP_UPDATER=false
CACHE_BRIDGE_MARKET_CAP_UPDATE_INTERVAL=
SOCKET_ROOT=
deploy_and_tests: deploy_and_tests:
needs: push_to_registry needs: push_to_registry

@ -59,17 +59,12 @@ jobs:
build-args: | build-args: |
CACHE_EXCHANGE_RATES_PERIOD= CACHE_EXCHANGE_RATES_PERIOD=
DISABLE_READ_API=false DISABLE_READ_API=false
API_PATH=
NETWORK_PATH=
DISABLE_WEBAPP=false DISABLE_WEBAPP=false
DISABLE_WRITE_API=false DISABLE_WRITE_API=false
CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER= CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER=
WOBSERVER_ENABLED=false WOBSERVER_ENABLED=false
ADMIN_PANEL_ENABLED=false ADMIN_PANEL_ENABLED=false
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL= CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
DISABLE_BRIDGE_MARKET_CAP_UPDATER=false
CACHE_BRIDGE_MARKET_CAP_UPDATE_INTERVAL=
SOCKET_ROOT=
- name: Build and push Docker image for frontend - name: Build and push Docker image for frontend
uses: docker/build-push-action@v3 uses: docker/build-push-action@v3
@ -82,17 +77,12 @@ jobs:
build-args: | build-args: |
CACHE_EXCHANGE_RATES_PERIOD= CACHE_EXCHANGE_RATES_PERIOD=
DISABLE_READ_API=false DISABLE_READ_API=false
API_PATH=
NETWORK_PATH=
DISABLE_WEBAPP=false DISABLE_WEBAPP=false
DISABLE_WRITE_API=false DISABLE_WRITE_API=false
CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER= CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER=
WOBSERVER_ENABLED=false WOBSERVER_ENABLED=false
ADMIN_PANEL_ENABLED=false ADMIN_PANEL_ENABLED=false
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL= CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
DISABLE_BRIDGE_MARKET_CAP_UPDATER=false
CACHE_BRIDGE_MARKET_CAP_UPDATE_INTERVAL=
SOCKET_ROOT=
SESSION_COOKIE_DOMAIN=${{ secrets.FRONTEND_MAIN }} SESSION_COOKIE_DOMAIN=${{ secrets.FRONTEND_MAIN }}
tests: tests:
needs: push_to_registry needs: push_to_registry

@ -56,15 +56,12 @@ jobs:
build-args: | build-args: |
CACHE_EXCHANGE_RATES_PERIOD= CACHE_EXCHANGE_RATES_PERIOD=
DISABLE_READ_API=false DISABLE_READ_API=false
API_PATH=/
NETWORK_PATH=/
DISABLE_WEBAPP=false DISABLE_WEBAPP=false
DISABLE_WRITE_API=false DISABLE_WRITE_API=false
CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER= CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER=
WOBSERVER_ENABLED=false WOBSERVER_ENABLED=false
ADMIN_PANEL_ENABLED= ADMIN_PANEL_ENABLED=
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL= CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
SOCKET_ROOT=
merge-master-after-release: merge-master-after-release:
name: Merge 'master' to specific branch after release name: Merge 'master' to specific branch after release

@ -25,6 +25,7 @@
### Chore ### Chore
- [#6954](https://github.com/blockscout/blockscout/pull/6954) - Move some compile time vars to runtime
- [#6952](https://github.com/blockscout/blockscout/pull/6952) - Manage BlockReward fetcher params - [#6952](https://github.com/blockscout/blockscout/pull/6952) - Manage BlockReward fetcher params
- [#6929](https://github.com/blockscout/blockscout/pull/6929) - Extend `INDEXER_MEMORY_LIMIT` env parsing - [#6929](https://github.com/blockscout/blockscout/pull/6929) - Extend `INDEXER_MEMORY_LIMIT` env parsing
- [#6902](https://github.com/blockscout/blockscout/pull/6902) - Increase verification timeout to 120 seconds for microservice verification - [#6902](https://github.com/blockscout/blockscout/pull/6902) - Increase verification timeout to 120 seconds for microservice verification

@ -15,8 +15,9 @@ export async function addChainToMM ({ btn }) {
const jsonRPCObj = document.getElementById('js-json-rpc') const jsonRPCObj = document.getElementById('js-json-rpc')
// @ts-ignore // @ts-ignore
const jsonRPC = jsonRPCObj && jsonRPCObj.value const jsonRPC = jsonRPCObj && jsonRPCObj.value
const pathObj = document.getElementById('network-path')
// @ts-ignore // @ts-ignore
const path = process.env.NETWORK_PATH || '/' const path = (pathObj && pathObj.value) || '/'
const blockscoutURL = location.protocol + '//' + location.host + path const blockscoutURL = location.protocol + '//' + location.host + path
if (chainIDFromWallet !== chainIDFromInstance) { if (chainIDFromWallet !== chainIDFromInstance) {

@ -1,8 +1,12 @@
import { Socket } from 'phoenix' import { Socket } from 'phoenix'
import { locale } from './locale' import { locale } from './locale'
// @ts-ignore const networkParhObj = document.getElementById('network-path')
let websocketRootUrl = process.env.SOCKET_ROOT let websocketRootUrl
if (networkParhObj) {
// @ts-ignore
websocketRootUrl = networkParhObj.value
}
if (!websocketRootUrl) { if (!websocketRootUrl) {
websocketRootUrl = '' websocketRootUrl = ''
} }

@ -166,8 +166,6 @@ const appJs =
), ),
new ContextReplacementPlugin(/moment[\/\\]locale$/, /en/), new ContextReplacementPlugin(/moment[\/\\]locale$/, /en/),
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env.SOCKET_ROOT': JSON.stringify(process.env.SOCKET_ROOT),
'process.env.NETWORK_PATH': JSON.stringify(process.env.NETWORK_PATH),
'process.env.MIXPANEL_TOKEN': JSON.stringify(process.env.MIXPANEL_TOKEN), 'process.env.MIXPANEL_TOKEN': JSON.stringify(process.env.MIXPANEL_TOKEN),
'process.env.MIXPANEL_URL': JSON.stringify(process.env.MIXPANEL_URL), 'process.env.MIXPANEL_URL': JSON.stringify(process.env.MIXPANEL_URL),
'process.env.AMPLITUDE_API_KEY': JSON.stringify(process.env.AMPLITUDE_API_KEY), 'process.env.AMPLITUDE_API_KEY': JSON.stringify(process.env.AMPLITUDE_API_KEY),

@ -5,24 +5,6 @@
# is restricted to this project. # is restricted to this project.
import Config import Config
network_path =
"NETWORK_PATH"
|> System.get_env("/")
|> (&(if String.ends_with?(&1, "/") do
String.trim_trailing(&1, "/")
else
&1
end)).()
api_path =
"API_PATH"
|> System.get_env("/")
|> (&(if String.ends_with?(&1, "/") do
String.trim_trailing(&1, "/")
else
&1
end)).()
# General application configuration # General application configuration
config :block_scout_web, config :block_scout_web,
namespace: BlockScoutWeb, namespace: BlockScoutWeb,
@ -36,15 +18,6 @@ config :block_scout_web, BlockScoutWeb.Counters.BlocksIndexedCounter, enabled: t
config :block_scout_web, BlockScoutWeb.Counters.InternalTransactionsIndexedCounter, enabled: true config :block_scout_web, BlockScoutWeb.Counters.InternalTransactionsIndexedCounter, enabled: true
# Configures the endpoint
config :block_scout_web, BlockScoutWeb.Endpoint,
url: [
path: network_path,
api_path: api_path
],
render_errors: [view: BlockScoutWeb.ErrorView, accepts: ~w(html json)],
pubsub_server: BlockScoutWeb.PubSub
config :block_scout_web, BlockScoutWeb.Tracer, config :block_scout_web, BlockScoutWeb.Tracer,
service: :block_scout_web, service: :block_scout_web,
adapter: SpandexDatadog.Adapter, adapter: SpandexDatadog.Adapter,

@ -59,23 +59,11 @@ defmodule BlockScoutWeb.Router do
get("/eth-rpc-api-docs", APIDocsController, :eth_rpc) get("/eth-rpc-api-docs", APIDocsController, :eth_rpc)
end end
url_params = Application.compile_env(:block_scout_web, BlockScoutWeb.Endpoint)[:url]
api_path = url_params[:api_path]
path = url_params[:path]
if path != api_path do
scope to_string(api_path) <> "/verify_smart_contract" do
pipe_through(:api)
post("/contract_verifications", BlockScoutWeb.AddressContractVerificationController, :create)
end
else
scope "/verify_smart_contract" do scope "/verify_smart_contract" do
pipe_through(:api) pipe_through(:api)
post("/contract_verifications", BlockScoutWeb.AddressContractVerificationController, :create) post("/contract_verifications", BlockScoutWeb.AddressContractVerificationController, :create)
end end
end
if Application.compile_env(:block_scout_web, WebRouter)[:enabled] do if Application.compile_env(:block_scout_web, WebRouter)[:enabled] do
forward("/", BlockScoutWeb.WebRouter) forward("/", BlockScoutWeb.WebRouter)

@ -64,6 +64,7 @@
<input id="js-chain-id" class="d-none" value="<%= Application.get_env(:block_scout_web, :chain_id) %>" /> <input id="js-chain-id" class="d-none" value="<%= Application.get_env(:block_scout_web, :chain_id) %>" />
<input id="js-json-rpc" class="d-none" value="<%= Application.get_env(:block_scout_web, :json_rpc) %>" /> <input id="js-json-rpc" class="d-none" value="<%= Application.get_env(:block_scout_web, :json_rpc) %>" />
<input id="re-captcha-client-key" class="d-none" value="<%= Application.get_env(:block_scout_web, :re_captcha_client_key) %>" /> <input id="re-captcha-client-key" class="d-none" value="<%= Application.get_env(:block_scout_web, :re_captcha_client_key) %>" />
<input id="network-path" class="d-none" value="<%= Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)[:url][:path] %>" />
<!-- --> <!-- -->
<% show_maintenance_alert = Application.get_env(:block_scout_web, BlockScoutWeb.Chain)[:show_maintenance_alert] %> <% show_maintenance_alert = Application.get_env(:block_scout_web, BlockScoutWeb.Chain)[:show_maintenance_alert] %>
<%= if show_maintenance_alert do %> <%= if show_maintenance_alert do %>

@ -49,16 +49,11 @@ defmodule BlockScoutWeb.APIDocsView do
end end
end end
def blockscout_url(set_path, is_api) when set_path == true do def blockscout_url(set_path) when set_path == true do
url_params = Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)[:url] url_params = Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)[:url]
host = url_params[:host] host = url_params[:host]
path = path = url_params[:path]
if is_api do
url_params[:api_path]
else
url_params[:path]
end
scheme = Keyword.get(url_params, :scheme, "http") scheme = Keyword.get(url_params, :scheme, "http")
@ -71,20 +66,14 @@ defmodule BlockScoutWeb.APIDocsView do
end end
def api_url do def api_url do
is_api = true true
set_path = true |> blockscout_url()
set_path
|> blockscout_url(is_api)
|> Path.join("api") |> Path.join("api")
end end
def eth_rpc_api_url do def eth_rpc_api_url do
is_api = true true
set_path = true |> blockscout_url()
set_path
|> blockscout_url(is_api)
|> Path.join("api/eth-rpc") |> Path.join("api/eth-rpc")
end end
end end

@ -6,7 +6,7 @@ defmodule BlockScoutWeb.Tokens.Instance.OverviewView do
alias Explorer.Chain.{Address, SmartContract, Token} alias Explorer.Chain.{Address, SmartContract, Token}
alias Explorer.SmartContract.Helper alias Explorer.SmartContract.Helper
import BlockScoutWeb.APIDocsView, only: [blockscout_url: 1, blockscout_url: 2] import BlockScoutWeb.APIDocsView, only: [blockscout_url: 1]
import BlockScoutWeb.NFTHelpers, only: [external_url: 1] import BlockScoutWeb.NFTHelpers, only: [external_url: 1]
@tabs ["token-transfers", "metadata"] @tabs ["token-transfers", "metadata"]
@ -92,24 +92,7 @@ defmodule BlockScoutWeb.Tokens.Instance.OverviewView do
def qr_code(conn, token_id, hash) do def qr_code(conn, token_id, hash) do
token_instance_path = token_instance_path(conn, :show, to_string(hash), to_string(token_id)) token_instance_path = token_instance_path(conn, :show, to_string(hash), to_string(token_id))
url_params = Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)[:url] url_prefix = blockscout_url(false)
api_path = url_params[:api_path]
path = url_params[:path]
url_prefix =
if String.length(path) > 0 && path != "/" do
set_path = false
blockscout_url(set_path)
else
if String.length(api_path) > 0 && api_path != "/" do
is_api = true
set_path = true
blockscout_url(set_path, is_api)
else
set_path = false
blockscout_url(set_path)
end
end
url = Path.join(url_prefix, token_instance_path) url = Path.join(url_prefix, token_instance_path)

@ -81,7 +81,7 @@ msgstr ""
msgid ") may be added for each contract. Click the Add Library button to add an additional one." msgid ") may be added for each contract. Click the Add Library button to add an additional one."
msgstr "" msgstr ""
#: lib/block_scout_web/templates/layout/app.html.eex:84 #: lib/block_scout_web/templates/layout/app.html.eex:85
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "- We're indexing this chain right now. Some of the counts may be inaccurate." msgid "- We're indexing this chain right now. Some of the counts may be inaccurate."
msgstr "" msgstr ""
@ -1672,7 +1672,7 @@ msgstr ""
#: lib/block_scout_web/templates/tokens/instance/metadata/index.html.eex:18 #: lib/block_scout_web/templates/tokens/instance/metadata/index.html.eex:18
#: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:10 #: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:10
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:128 #: lib/block_scout_web/views/tokens/instance/overview_view.ex:111
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Metadata" msgid "Metadata"
msgstr "" msgstr ""
@ -2736,7 +2736,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:4 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:4
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7 #: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7
#: lib/block_scout_web/views/address_view.ex:373 #: lib/block_scout_web/views/address_view.ex:373
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:127 #: lib/block_scout_web/views/tokens/instance/overview_view.ex:110
#: lib/block_scout_web/views/tokens/overview_view.ex:39 #: lib/block_scout_web/views/tokens/overview_view.ex:39
#: lib/block_scout_web/views/transaction_view.ex:527 #: lib/block_scout_web/views/transaction_view.ex:527
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format

@ -81,7 +81,7 @@ msgstr ""
msgid ") may be added for each contract. Click the Add Library button to add an additional one." msgid ") may be added for each contract. Click the Add Library button to add an additional one."
msgstr "" msgstr ""
#: lib/block_scout_web/templates/layout/app.html.eex:84 #: lib/block_scout_web/templates/layout/app.html.eex:85
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "- We're indexing this chain right now. Some of the counts may be inaccurate." msgid "- We're indexing this chain right now. Some of the counts may be inaccurate."
msgstr "" msgstr ""
@ -1672,7 +1672,7 @@ msgstr ""
#: lib/block_scout_web/templates/tokens/instance/metadata/index.html.eex:18 #: lib/block_scout_web/templates/tokens/instance/metadata/index.html.eex:18
#: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:10 #: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:10
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:128 #: lib/block_scout_web/views/tokens/instance/overview_view.ex:111
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Metadata" msgid "Metadata"
msgstr "" msgstr ""
@ -2736,7 +2736,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:4 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:4
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7 #: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7
#: lib/block_scout_web/views/address_view.ex:373 #: lib/block_scout_web/views/address_view.ex:373
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:127 #: lib/block_scout_web/views/tokens/instance/overview_view.ex:110
#: lib/block_scout_web/views/tokens/overview_view.ex:39 #: lib/block_scout_web/views/tokens/overview_view.ex:39
#: lib/block_scout_web/views/transaction_view.ex:527 #: lib/block_scout_web/views/transaction_view.ex:527
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format

@ -14,7 +14,7 @@ defmodule BlockScoutWeb.ApiDocsViewTest do
test "adds slash before path" do test "adds slash before path" do
Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint, Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint,
url: [scheme: "https", host: "blockscout.com", port: 9999, api_path: "/chain/dog"] url: [scheme: "https", host: "blockscout.com", port: 9999, path: "/chain/dog"]
) )
assert APIDocsView.api_url() == "https://blockscout.com/chain/dog/api" assert APIDocsView.api_url() == "https://blockscout.com/chain/dog/api"
@ -22,7 +22,7 @@ defmodule BlockScoutWeb.ApiDocsViewTest do
test "does not add slash to empty path" do test "does not add slash to empty path" do
Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint, Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint,
url: [scheme: "https", host: "blockscout.com", port: 9999, api_path: ""] url: [scheme: "https", host: "blockscout.com", port: 9999, path: ""]
) )
assert APIDocsView.api_url() == "https://blockscout.com/api" assert APIDocsView.api_url() == "https://blockscout.com/api"
@ -38,7 +38,7 @@ defmodule BlockScoutWeb.ApiDocsViewTest do
end end
end end
describe "blockscout_url/2" do describe "blockscout_url/1" do
setup do setup do
original = Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint) original = Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)
@ -49,35 +49,19 @@ defmodule BlockScoutWeb.ApiDocsViewTest do
test "set_path = true returns url with path" do test "set_path = true returns url with path" do
Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint, Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint,
url: [scheme: "https", host: "blockscout.com", api_path: "/eth/mainnet", path: "/eth/mainnet"] url: [scheme: "https", host: "blockscout.com", path: "/eth/mainnet"]
) )
assert APIDocsView.blockscout_url(true, true) == "https://blockscout.com/eth/mainnet" assert APIDocsView.blockscout_url(true) == "https://blockscout.com/eth/mainnet"
end end
test "set_path = false returns url w/out path" do test "set_path = false returns url w/out path" do
Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint, Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint,
url: [scheme: "https", host: "blockscout.com", api_path: "/eth/mainnet", path: "/eth/mainnet"] url: [scheme: "https", host: "blockscout.com", path: "/eth/mainnet"]
) )
assert APIDocsView.blockscout_url(false) == "https://blockscout.com" assert APIDocsView.blockscout_url(false) == "https://blockscout.com"
end end
test "set_path = true is_api returns url with api_path" do
Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint,
url: [scheme: "https", host: "blockscout.com", api_path: "/eth/mainnet", path: "/"]
)
assert APIDocsView.blockscout_url(true, true) == "https://blockscout.com/eth/mainnet"
end
test "set_path = true is_api returns url with path" do
Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint,
url: [scheme: "https", host: "blockscout.com", api_path: "/eth/mainnet", path: "/eth/mainnet2"]
)
assert APIDocsView.blockscout_url(true, false) == "https://blockscout.com/eth/mainnet2"
end
end end
describe "eth_rpc_api_url/1" do describe "eth_rpc_api_url/1" do
@ -91,7 +75,7 @@ defmodule BlockScoutWeb.ApiDocsViewTest do
test "adds slash before path" do test "adds slash before path" do
Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint, Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint,
url: [scheme: "https", host: "blockscout.com", port: 9999, api_path: "/chain/dog"] url: [scheme: "https", host: "blockscout.com", port: 9999, path: "/chain/dog"]
) )
assert APIDocsView.eth_rpc_api_url() == "https://blockscout.com/chain/dog/api/eth-rpc" assert APIDocsView.eth_rpc_api_url() == "https://blockscout.com/chain/dog/api/eth-rpc"

@ -64,12 +64,6 @@ defmodule Explorer.Repo.ConfigHelper do
path_from_env(path) path_from_env(path)
end end
def api_path do
path = System.get_env("API_PATH", "/")
path_from_env(path)
end
defp path_from_env(path_env_var) do defp path_from_env(path_env_var) do
if String.ends_with?(path_env_var, "/") do if String.ends_with?(path_env_var, "/") do
path_env_var path_env_var

@ -31,16 +31,33 @@ indexer_empty_blocks_sanitizer_batch_size =
config :indexer, Indexer.Fetcher.EmptyBlocksSanitizer, batch_size: indexer_empty_blocks_sanitizer_batch_size config :indexer, Indexer.Fetcher.EmptyBlocksSanitizer, batch_size: indexer_empty_blocks_sanitizer_batch_size
######################
### BlockScout Web ###
######################
network_path =
"NETWORK_PATH"
|> System.get_env("/")
|> (&(if String.ends_with?(&1, "/") do
String.trim_trailing(&1, "/")
else
&1
end)).()
# Configures the endpoint
config :block_scout_web, BlockScoutWeb.Endpoint,
url: [
path: network_path
],
render_errors: [view: BlockScoutWeb.ErrorView, accepts: ~w(html json)],
pubsub_server: BlockScoutWeb.PubSub
config :block_scout_web, :footer, config :block_scout_web, :footer,
chat_link: System.get_env("FOOTER_CHAT_LINK", "https://discord.gg/blockscout"), chat_link: System.get_env("FOOTER_CHAT_LINK", "https://discord.gg/blockscout"),
forum_link: System.get_env("FOOTER_FORUM_LINK", "https://forum.poa.network/c/blockscout"), forum_link: System.get_env("FOOTER_FORUM_LINK", "https://forum.poa.network/c/blockscout"),
github_link: System.get_env("FOOTER_GITHUB_LINK", "https://github.com/blockscout/blockscout"), github_link: System.get_env("FOOTER_GITHUB_LINK", "https://github.com/blockscout/blockscout"),
enable_forum_link: System.get_env("FOOTER_ENABLE_FORUM_LINK", "false") == "true" enable_forum_link: System.get_env("FOOTER_ENABLE_FORUM_LINK", "false") == "true"
######################
### BlockScout Web ###
######################
# Configures Ueberauth's Auth0 auth provider # Configures Ueberauth's Auth0 auth provider
config :ueberauth, Ueberauth.Strategy.Auth0.OAuth, config :ueberauth, Ueberauth.Strategy.Auth0.OAuth,
domain: System.get_env("ACCOUNT_AUTH0_DOMAIN"), domain: System.get_env("ACCOUNT_AUTH0_DOMAIN"),

@ -23,13 +23,10 @@ services:
args: args:
CACHE_EXCHANGE_RATES_PERIOD: "" CACHE_EXCHANGE_RATES_PERIOD: ""
DISABLE_READ_API: "false" DISABLE_READ_API: "false"
API_PATH: "/"
NETWORK_PATH: "/"
DISABLE_WEBAPP: "false" DISABLE_WEBAPP: "false"
DISABLE_WRITE_API: "false" DISABLE_WRITE_API: "false"
CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER: "" CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER: ""
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL: "" CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL: ""
SOCKET_ROOT: "/"
WOBSERVER_ENABLED: "false" WOBSERVER_ENABLED: "false"
ADMIN_PANEL_ENABLED: "" ADMIN_PANEL_ENABLED: ""
restart: always restart: always

@ -24,13 +24,10 @@ services:
args: args:
CACHE_EXCHANGE_RATES_PERIOD: "" CACHE_EXCHANGE_RATES_PERIOD: ""
DISABLE_READ_API: "false" DISABLE_READ_API: "false"
API_PATH: "/"
NETWORK_PATH: "/"
DISABLE_WEBAPP: "false" DISABLE_WEBAPP: "false"
DISABLE_WRITE_API: "false" DISABLE_WRITE_API: "false"
CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER: "" CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER: ""
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL: "" CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL: ""
SOCKET_ROOT: "/"
WOBSERVER_ENABLED: "false" WOBSERVER_ENABLED: "false"
ADMIN_PANEL_ENABLED: "" ADMIN_PANEL_ENABLED: ""
restart: always restart: always

@ -12,8 +12,6 @@ ETHEREUM_JSONRPC_TRANSPORT=http
ETHEREUM_JSONRPC_DISABLE_ARCHIVE_BALANCES=false ETHEREUM_JSONRPC_DISABLE_ARCHIVE_BALANCES=false
IPC_PATH= IPC_PATH=
NETWORK_PATH=/ NETWORK_PATH=/
API_PATH=/
SOCKET_ROOT=/
BLOCKSCOUT_HOST= BLOCKSCOUT_HOST=
BLOCKSCOUT_PROTOCOL= BLOCKSCOUT_PROTOCOL=
# SECRET_KEY_BASE= # SECRET_KEY_BASE=
@ -69,7 +67,6 @@ CACHE_MARKET_HISTORY_PERIOD=21600
CACHE_ADDRESS_TRANSACTIONS_COUNTER_PERIOD=1800 CACHE_ADDRESS_TRANSACTIONS_COUNTER_PERIOD=1800
CACHE_ADDRESS_TOKENS_USD_SUM_PERIOD=1800 CACHE_ADDRESS_TOKENS_USD_SUM_PERIOD=1800
CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD=1800 CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD=1800
CACHE_BRIDGE_MARKET_CAP_UPDATE_INTERVAL=1800
CACHE_TOKEN_EXCHANGE_RATE_PERIOD=1800 CACHE_TOKEN_EXCHANGE_RATE_PERIOD=1800
TOKEN_METADATA_UPDATE_INTERVAL=172800 TOKEN_METADATA_UPDATE_INTERVAL=172800
ALLOWED_EVM_VERSIONS=homestead,tangerineWhistle,spuriousDragon,byzantium,constantinople,petersburg,istanbul,berlin,london,default ALLOWED_EVM_VERSIONS=homestead,tangerineWhistle,spuriousDragon,byzantium,constantinople,petersburg,istanbul,berlin,london,default

@ -25,15 +25,12 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ARG CACHE_EXCHANGE_RATES_PERIOD ARG CACHE_EXCHANGE_RATES_PERIOD
ARG DISABLE_READ_API ARG DISABLE_READ_API
ARG API_PATH
ARG NETWORK_PATH
ARG DISABLE_WEBAPP ARG DISABLE_WEBAPP
ARG DISABLE_WRITE_API ARG DISABLE_WRITE_API
ARG CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER ARG CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER
ARG WOBSERVER_ENABLED ARG WOBSERVER_ENABLED
ARG ADMIN_PANEL_ENABLED ARG ADMIN_PANEL_ENABLED
ARG CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL ARG CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL
ARG SOCKET_ROOT
ARG SESSION_COOKIE_DOMAIN ARG SESSION_COOKIE_DOMAIN
ARG MIXPANEL_TOKEN ARG MIXPANEL_TOKEN
ARG MIXPANEL_URL ARG MIXPANEL_URL

@ -211,12 +211,6 @@ endif
ifdef DECOMPILED_SMART_CONTRACT_TOKEN ifdef DECOMPILED_SMART_CONTRACT_TOKEN
BLOCKSCOUT_CONTAINER_PARAMS += -e 'DECOMPILED_SMART_CONTRACT_TOKEN=$(DECOMPILED_SMART_CONTRACT_TOKEN)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'DECOMPILED_SMART_CONTRACT_TOKEN=$(DECOMPILED_SMART_CONTRACT_TOKEN)'
endif endif
ifdef SOCKET_ROOT
BLOCKSCOUT_CONTAINER_PARAMS += -e 'SOCKET_ROOT=$(SOCKET_ROOT)'
endif
ifdef API_PATH
BLOCKSCOUT_CONTAINER_PARAMS += -e 'API_PATH=$(API_PATH)'
endif
ifdef CHECKSUM_ADDRESS_HASHES ifdef CHECKSUM_ADDRESS_HASHES
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CHECKSUM_ADDRESS_HASHES=$(CHECKSUM_ADDRESS_HASHES)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'CHECKSUM_ADDRESS_HASHES=$(CHECKSUM_ADDRESS_HASHES)'
endif endif
@ -271,9 +265,6 @@ endif
ifdef WOBSERVER_ENABLED ifdef WOBSERVER_ENABLED
BLOCKSCOUT_CONTAINER_PARAMS += -e 'WOBSERVER_ENABLED=$(WOBSERVER_ENABLED)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'WOBSERVER_ENABLED=$(WOBSERVER_ENABLED)'
endif endif
ifdef CACHE_BRIDGE_MARKET_CAP_UPDATE_INTERVAL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_BRIDGE_MARKET_CAP_UPDATE_INTERVAL=$(CACHE_BRIDGE_MARKET_CAP_UPDATE_INTERVAL)'
endif
ifdef RESTRICTED_LIST ifdef RESTRICTED_LIST
BLOCKSCOUT_CONTAINER_PARAMS += -e 'RESTRICTED_LIST=$(RESTRICTED_LIST)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'RESTRICTED_LIST=$(RESTRICTED_LIST)'
endif endif

Loading…
Cancel
Save