@@ -14,15 +14,22 @@ mod websockets;
14
14
// this specifies number of messages that can be held by the channel, not number of the clients.
15
15
const BROADCAST_CAPACITY : usize = 10 ;
16
16
const VALIDATOR_ARG : & str = "validator" ;
17
+ const METRICS_ARG : & str = "metrics" ;
17
18
18
19
fn parse_args < ' a > ( ) -> ArgMatches < ' a > {
19
20
App :: new ( "Nym Explorer" )
20
21
. author ( "Nymtech" )
21
22
. arg (
22
23
Arg :: with_name ( VALIDATOR_ARG )
23
- . help ( "REST endpoint of the explorer will use to periodically grab topology and node status." )
24
+ . long ( VALIDATOR_ARG )
25
+ . help ( "REST endpoint of the validator that explorer will use to periodically grab topology and node status." )
26
+ . takes_value ( true )
27
+ )
28
+ . arg (
29
+ Arg :: with_name ( METRICS_ARG )
30
+ . long ( METRICS_ARG )
31
+ . help ( "websocket endpoint of the metrics server explorer will subscribe to and broadcast to its clients" )
24
32
. takes_value ( true )
25
- . required ( true ) ,
26
33
)
27
34
. get_matches ( )
28
35
}
@@ -35,7 +42,13 @@ fn index() -> &'static str {
35
42
#[ tokio:: main]
36
43
async fn main ( ) {
37
44
let matches = parse_args ( ) ;
38
- let validator_base_url = matches. value_of ( VALIDATOR_ARG ) . unwrap ( ) ;
45
+ let validator_base_url = matches
46
+ . value_of ( VALIDATOR_ARG )
47
+ . unwrap_or_else ( || "http://testnet-validator1.nymtech.net:8081" ) ;
48
+ let metrics_websocket_url = matches
49
+ . value_of ( METRICS_ARG )
50
+ . unwrap_or_else ( || "wss://testnet-metrics.nymtech.net/ws" )
51
+ . to_owned ( ) ;
39
52
40
53
let public_path = std:: env:: current_exe ( )
41
54
. expect ( "Failed to evaluate current exe path" )
@@ -55,7 +68,7 @@ async fn main() {
55
68
let sender_clone = sender. clone ( ) ;
56
69
57
70
tokio:: spawn ( async move {
58
- websockets:: subscribe ( "wss://qa-metrics.nymtech.net/ws" , sender) . await ;
71
+ websockets:: subscribe ( & * metrics_websocket_url , sender) . await ;
59
72
} ) ;
60
73
61
74
tokio:: spawn ( async move {
0 commit comments