diff --git a/apps/block_scout_web/lib/block_scout_web/templates/api_docs/eth_rpc.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/api_docs/eth_rpc.html.eex index 3a0338f4a3..37b9ecdaa2 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/api_docs/eth_rpc.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/api_docs/eth_rpc.html.eex @@ -2,9 +2,9 @@

<%= gettext("ETH RPC API Documentation") %>

-

[ <%= gettext "Base URL:" %> <%= BlockScoutWeb.Endpoint.url() %>/api/eth_rpc ]

+

[ <%= gettext "Base URL:" %> <%= url() %>/api/eth_rpc ]

- <%= gettext "This API is provided to support some rpc methods in the exact format specified for ethereum nodes, which can be found " %> + <%= gettext "This API is provided to support some rpc methods in the exact format specified for ethereum nodes, which can be found " %> <%= gettext "here." %> <%= gettext "This is useful to allow sending requests to blockscout without having to change anything about the request." %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/api_docs/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/api_docs/index.html.eex index 0f97b67d45..5244458bb6 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/api_docs/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/api_docs/index.html.eex @@ -2,7 +2,7 @@

<%= gettext("API Documentation") %>

-

[ <%= gettext "Base URL:" %> <%= BlockScoutWeb.Endpoint.url() %>/api ]

+

[ <%= gettext "Base URL:" %> <%= url() %>/api ]

<%= gettext "This API is provided for developers transitioning their applications from Etherscan to BlockScout. It supports GET and POST requests." %>

diff --git a/apps/block_scout_web/lib/block_scout_web/views/api_docs_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api_docs_view.ex index cbc096aeb8..267099fa2b 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/api_docs_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/api_docs_view.ex @@ -1,7 +1,7 @@ defmodule BlockScoutWeb.APIDocsView do use BlockScoutWeb, :view - alias BlockScoutWeb.LayoutView + alias BlockScoutWeb.{Endpoint, LayoutView} def action_tile_id(module, action) do "#{module}-#{action}" @@ -33,4 +33,12 @@ defmodule BlockScoutWeb.APIDocsView do "&#{param.key}=" <> "{#{param.placeholder}}" end) end + + defp url do + if System.get_env("BLOCKSCOUT_HOST") do + "http://" <> System.get_env("BLOCKSCOUT_HOST") + else + Endpoint.url() + end + end end