Skip to content

Commit 12120d4

Browse files
committed
fix(c-bridge): properly read testnet environment config from envars
1 parent f58517e commit 12120d4

File tree

1 file changed

+9
-2
lines changed
  • bridges/centralized-ethereum/src

1 file changed

+9
-2
lines changed

bridges/centralized-ethereum/src/main.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Witnet <> Ethereum bridge
22
33
use actix::{Actor, System, SystemRegistry};
4+
use witnet_data_structures::chain::Environment;
45
use std::{path::PathBuf, process::exit, sync::Arc};
56
use structopt::StructOpt;
67

@@ -59,9 +60,15 @@ fn main() {
5960
fn run(callback: fn()) -> Result<(), String> {
6061
let app = App::from_args();
6162
let config = if app.env {
62-
config::from_env()
63+
let config = config::from_env()
6364
.map(Arc::new)
64-
.map_err(|e| format!("Error reading configuration from environment: {}", e))?
65+
.map_err(|e| format!("Error reading configuration from environment: {}", e))?;
66+
witnet_data_structures::set_environment(if config.witnet_testnet {
67+
Environment::Testnet
68+
} else {
69+
Environment::Mainnet
70+
});
71+
config
6572
} else {
6673
config::from_file(
6774
app.config

0 commit comments

Comments
 (0)