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 12120d4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions bridges/centralized-ethereum/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Witnet <> Ethereum bridge
use actix::{Actor, System, SystemRegistry};
use witnet_data_structures::chain::Environment;
use std::{path::PathBuf, process::exit, sync::Arc};
use structopt::StructOpt;

Expand Down Expand Up @@ -59,9 +60,15 @@ fn main() {
fn run(callback: fn()) -> Result<(), String> {
let app = App::from_args();
let config = if app.env {
config::from_env()
let config = config::from_env()
.map(Arc::new)
.map_err(|e| format!("Error reading configuration from environment: {}", e))?
.map_err(|e| format!("Error reading configuration from environment: {}", e))?;
witnet_data_structures::set_environment(if config.witnet_testnet {
Environment::Testnet
} else {
Environment::Mainnet
});
config
} else {
config::from_file(
app.config
Expand Down

0 comments on commit 12120d4

Please sign in to comment.