Skip to content

Commit

Permalink
fix(c-bridge): properly read testnet environment config from envars
Browse files Browse the repository at this point in the history
  • Loading branch information
guidiaz committed Feb 6, 2025
1 parent f58517e commit 9ac779f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions bridges/centralized-ethereum/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,16 @@ pub fn from_file<S: AsRef<Path>>(file: S) -> Result<Config, Box<dyn std::error::
/// Load configuration from environment variables
pub fn from_env() -> Result<Config, envy::Error> {
USING_ENVY.with(|x| x.set(true));
let res = envy::prefixed("WITNET_CENTRALIZED_ETHEREUM_BRIDGE_").from_env();
let res: Result<Config, envy::Error> =
envy::prefixed("WITNET_CENTRALIZED_ETHEREUM_BRIDGE_").from_env();
USING_ENVY.with(|x| x.set(false));

if let Ok(ref config) = res {
witnet_data_structures::set_environment(if config.witnet_testnet {
Environment::Testnet
} else {
Environment::Mainnet
});
}
res
}

Expand Down

0 comments on commit 9ac779f

Please sign in to comment.