Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(c-bridge): properly read testnet environment config from envars #2589

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading