diff --git a/explorer/src/main.rs b/explorer/src/main.rs index 24df8945e0d..60a841be082 100644 --- a/explorer/src/main.rs +++ b/explorer/src/main.rs @@ -14,15 +14,22 @@ mod websockets; // this specifies number of messages that can be held by the channel, not number of the clients. const BROADCAST_CAPACITY: usize = 10; const VALIDATOR_ARG: &str = "validator"; +const METRICS_ARG: &str = "metrics"; fn parse_args<'a>() -> ArgMatches<'a> { App::new("Nym Explorer") .author("Nymtech") .arg( Arg::with_name(VALIDATOR_ARG) - .help("REST endpoint of the explorer will use to periodically grab topology and node status.") + .long(VALIDATOR_ARG) + .help("REST endpoint of the validator that explorer will use to periodically grab topology and node status.") + .takes_value(true) + ) + .arg( + Arg::with_name(METRICS_ARG) + .long(METRICS_ARG) + .help("websocket endpoint of the metrics server explorer will subscribe to and broadcast to its clients") .takes_value(true) - .required(true), ) .get_matches() } @@ -35,7 +42,13 @@ fn index() -> &'static str { #[tokio::main] async fn main() { let matches = parse_args(); - let validator_base_url = matches.value_of(VALIDATOR_ARG).unwrap(); + let validator_base_url = matches + .value_of(VALIDATOR_ARG) + .unwrap_or_else(|| "http://testnet-validator1.nymtech.net:8081"); + let metrics_websocket_url = matches + .value_of(METRICS_ARG) + .unwrap_or_else(|| "wss://testnet-metrics.nymtech.net/ws") + .to_owned(); tokio::task::spawn_blocking(|| { rocket::ignite() @@ -49,7 +62,7 @@ async fn main() { let sender_clone = sender.clone(); tokio::spawn(async move { - websockets::subscribe("wss://qa-metrics.nymtech.net/ws", sender).await; + websockets::subscribe(&*metrics_websocket_url, sender).await; }); tokio::spawn(async move {