Skip to content

Commit

Permalink
collapse env vars into single existing var
Browse files Browse the repository at this point in the history
  • Loading branch information
EasterTheBunny committed Dec 13, 2024
1 parent 8caab5c commit a449414
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
23 changes: 7 additions & 16 deletions core/chains/evm/config/toml/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down Expand Up @@ -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())
}

Expand Down
1 change: 0 additions & 1 deletion core/config/env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a449414

Please sign in to comment.