From 9ac779f1b45889d943931ed39edeb60a490767ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Thu, 6 Feb 2025 15:35:13 +0100 Subject: [PATCH] fix(c-bridge): properly read testnet environment config from envars --- bridges/centralized-ethereum/src/config.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bridges/centralized-ethereum/src/config.rs b/bridges/centralized-ethereum/src/config.rs index 2d1bb87750..ceaf03047a 100644 --- a/bridges/centralized-ethereum/src/config.rs +++ b/bridges/centralized-ethereum/src/config.rs @@ -126,9 +126,16 @@ pub fn from_file>(file: S) -> Result Result { USING_ENVY.with(|x| x.set(true)); - let res = envy::prefixed("WITNET_CENTRALIZED_ETHEREUM_BRIDGE_").from_env(); + let res: Result = + 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 }