diff --git a/apps/explorer/lib/explorer/application.ex b/apps/explorer/lib/explorer/application.ex index 2e7638cfd0..2e64c60085 100644 --- a/apps/explorer/lib/explorer/application.ex +++ b/apps/explorer/lib/explorer/application.ex @@ -143,7 +143,7 @@ defmodule Explorer.Application do configure(Explorer.Migrator.TokenTransferBlockConsensus), configure(Explorer.Migrator.RestoreOmittedWETHTransfers), configure_chain_type_dependent_process(Explorer.Chain.Cache.StabilityValidatorsCounters, :stability), - configure(Explorer.Migrator.ShrinkInternalTransactions) + configure_mode_dependent_process(Explorer.Migrator.ShrinkInternalTransactions, :indexer) ] |> List.flatten() @@ -209,6 +209,14 @@ defmodule Explorer.Application do end end + defp configure_mode_dependent_process(process, mode) do + if Application.get_env(:explorer, :mode) in [mode, :all] do + process + else + [] + end + end + defp sc_microservice_configure(process) do if Application.get_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour)[:eth_bytecode_db?] do process diff --git a/config/config_helper.exs b/config/config_helper.exs index ffaf0ad0db..9b37f09544 100644 --- a/config/config_helper.exs +++ b/config/config_helper.exs @@ -322,6 +322,11 @@ defmodule ConfigHelper do @spec chain_type() :: atom() | nil def chain_type, do: parse_catalog_value("CHAIN_TYPE", @supported_chain_types, true, "default") + @supported_modes ["all", "indexer", "api"] + + @spec mode :: atom() + def mode, do: parse_catalog_value("MODE", @supported_modes, true, "all") + @spec eth_call_url(String.t() | nil) :: String.t() | nil def eth_call_url(default \\ nil) do System.get_env("ETHEREUM_JSONRPC_ETH_CALL_URL") || System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || default diff --git a/config/runtime.exs b/config/runtime.exs index 4bbb936c3d..7c59765fdd 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -218,6 +218,7 @@ checksum_function = System.get_env("CHECKSUM_FUNCTION") exchange_rates_coin = System.get_env("EXCHANGE_RATES_COIN") config :explorer, + mode: ConfigHelper.mode(), coin: System.get_env("COIN") || exchange_rates_coin || "ETH", coin_name: System.get_env("COIN_NAME") || exchange_rates_coin || "ETH", allowed_solidity_evm_versions: