From 43029651877e15ca80d0cbe12e35acf2ca89b448 Mon Sep 17 00:00:00 2001 From: Awbrey Hughlett Date: Fri, 13 Dec 2024 10:18:27 -0600 Subject: [PATCH] collapse env vars into single existing var --- core/chains/evm/config/toml/defaults.go | 23 +++++++---------------- core/config/env/env.go | 1 - 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/core/chains/evm/config/toml/defaults.go b/core/chains/evm/config/toml/defaults.go index da7320458ca..5cffe46d134 100644 --- a/core/chains/evm/config/toml/defaults.go +++ b/core/chains/evm/config/toml/defaults.go @@ -35,21 +35,6 @@ func init() { // read all default configs initReadDefaults() - // overrides should be applied as: - // fallback.toml(defaults dir) <- fallback.toml(env CL_CHAIN_FALLBACK) <- ChainSpecific.toml(env CL_CHAIN_DEFAULTS) - // - // the custom fallback gets processed and overrides the default fallback - if path := env.CustomFallback.Get(); path != "" { - _, chain, err := readConfig(path, os.ReadFile, true) - if err != nil { - if !errors.Is(err, errFallbackConfig) { - log.Fatalf("custom fallback config error: %s", err.Error()) - } - - fallback = chain - } - } - // check for and apply any overrides initApplyEVMOverrides() } @@ -134,8 +119,14 @@ func initApplyEVMOverrides() { // read the file to bytes path := evmDir + "/" + entry.Name() - chainID, chain, err := readConfig(path, os.ReadFile, false) + chainID, chain, err := readConfig(path, os.ReadFile, entry.Name() == "fallback.toml") if err != nil { + if errors.Is(err, errFallbackConfig) { + fallback = chain + + continue + } + log.Fatalf("custom defaults override failure (%s): %s", entry.Name(), err.Error()) } diff --git a/core/config/env/env.go b/core/config/env/env.go index 8a24ff21476..c34cd7f4f5e 100644 --- a/core/config/env/env.go +++ b/core/config/env/env.go @@ -21,7 +21,6 @@ var ( // Migrations env vars EVMChainIDNotNullMigration0195 = "CL_EVM_CHAINID_NOT_NULL_MIGRATION_0195" CustomDefaults = Var("CL_CHAIN_DEFAULTS") - CustomFallback = Var("CL_CHAIN_FALLBACK") ) // LOOPP commands and vars