Skip to content

Commit 7a709a2

Browse files
committed
Use SocketAddr instead of parsing string for metrics config listen address
1 parent 01afd49 commit 7a709a2

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

cli/src/cmd/testnet/add_node.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! Add a non-validator node to an existing testnet
22
3+
use core::net::{Ipv4Addr, SocketAddr, SocketAddrV4};
34
use core::time::Duration;
45
use std::fs;
56
use std::path::{Path, PathBuf};
@@ -246,7 +247,10 @@ impl TestnetAddNodeCmd {
246247
},
247248
metrics: MetricsConfig {
248249
enabled: true,
249-
listen_addr: format!("127.0.0.1:{metrics_port}").parse().unwrap(),
250+
listen_addr: SocketAddr::V4(SocketAddrV4::new(
251+
Ipv4Addr::new(127, 0, 0, 1),
252+
metrics_port as u16,
253+
)),
250254
},
251255
logging: LoggingConfig::default(),
252256
runtime: RuntimeConfig::SingleThreaded,

0 commit comments

Comments
 (0)