1
0
mirror of https://github.com/romanz/electrs.git synced 2024-11-19 09:54:09 +01:00

Change defaults addresses to 'localhost'

This commit is contained in:
Roman Zeyde 2019-02-25 21:10:30 +02:00
parent d614071dd4
commit ed125ebe92
No known key found for this signature in database
GPG Key ID: 87CAE5FA46917CBB

View File

@ -35,9 +35,8 @@ fn str_to_socketaddr(address: &str, what: &str) -> SocketAddr {
address
.to_socket_addrs()
.expect(&format!("unable to resolve {} address", what))
.collect::<Vec<_>>()
.pop()
.unwrap()
.next()
.expect(&format!("no address found for {}", address))
}
impl Config {
@ -162,17 +161,17 @@ impl Config {
let daemon_rpc_addr: SocketAddr = str_to_socketaddr(
m.value_of("daemon_rpc_addr")
.unwrap_or(&format!("127.0.0.1:{}", default_daemon_port)),
.unwrap_or(&format!("localhost:{}", default_daemon_port)),
"Bitcoin RPC",
);
let electrum_rpc_addr: SocketAddr = str_to_socketaddr(
m.value_of("electrum_rpc_addr")
.unwrap_or(&format!("127.0.0.1:{}", default_electrum_port)),
.unwrap_or(&format!("localhost:{}", default_electrum_port)),
"Electrum RPC",
);
let monitoring_addr: SocketAddr = str_to_socketaddr(
m.value_of("monitoring_addr")
.unwrap_or(&format!("127.0.0.1:{}", default_monitoring_port)),
.unwrap_or(&format!("localhost:{}", default_monitoring_port)),
"Prometheus monitoring",
);