Skip to content

Commit f56c8f0

Browse files
committed
Move var from env to config
1 parent af22aee commit f56c8f0

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

server/src/conf.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ pub struct Conf {
1212
pub data_directory: PathBuf,
1313
/// When running only the indexer, the address of the DA server to connect to
1414
pub da_read_from: String,
15+
pub node_url: String,
16+
pub indexer_url: String,
1517

1618
pub rest_server_port: u16,
1719
pub rest_server_max_body_size: usize,

server/src/conf_defaults.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ da_read_from = "127.0.0.1:4141"
66

77
rest_server_port = 4000
88
rest_server_max_body_size = 10_485_760 # 10 MB
9-
10-
da_address = "127.0.0.1:4141"
9+
node_url = "http://localhost:4321"
10+
indexer_url = "http://localhost:4321"
1111

1212
[websocket]
13-
port = 8081
13+
port = 8080
1414
ws_path = "/ws"
1515
health_path = "/ws_health"
1616
peer_check_interval.secs = 0

server/src/main.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ use hyle_modules::{
2323

2424
use prometheus::Registry;
2525
use sdk::{api::NodeInfo, info, ContractName, ZkContract};
26-
use std::{
27-
env,
28-
sync::{Arc, Mutex},
29-
};
26+
use std::sync::{Arc, Mutex};
3027
use tracing::error;
3128
use wallet::{client::indexer::WalletEvent, Wallet};
3229

@@ -60,12 +57,11 @@ async fn main() -> Result<()> {
6057

6158
info!("Starting app with config: {:?}", &config);
6259

63-
let node_url = env::var("NODE_URL").unwrap_or_else(|_| "http://localhost:4321".to_string());
64-
let indexer_url =
65-
env::var("INDEXER_URL").unwrap_or_else(|_| "http://localhost:4321".to_string());
66-
let node_client = Arc::new(NodeApiHttpClient::new(node_url).context("build node client")?);
67-
let indexer_client =
68-
Arc::new(IndexerApiHttpClient::new(indexer_url).context("build indexer client")?);
60+
let node_client =
61+
Arc::new(NodeApiHttpClient::new(config.node_url.clone()).context("build node client")?);
62+
let indexer_client = Arc::new(
63+
IndexerApiHttpClient::new(config.indexer_url.clone()).context("build indexer client")?,
64+
);
6965

7066
let wallet_cn: ContractName = args.wallet_cn.clone().into();
7167

0 commit comments

Comments
 (0)