diff --git a/radicle-node/src/main.rs b/radicle-node/src/main.rs index a646053e..4d6d9c32 100644 --- a/radicle-node/src/main.rs +++ b/radicle-node/src/main.rs @@ -112,6 +112,11 @@ fn execute() -> anyhow::Result<()> { let daemon = options.daemon.unwrap_or_else(|| { net::SocketAddr::new(net::Ipv4Addr::LOCALHOST.into(), radicle::git::PROTOCOL_PORT) }); + let listen: Vec = if !options.listen.is_empty() { + options.listen.clone() + } else { + config.listen.clone() + }; let (notify, signals) = chan::bounded(1); signals::install(notify)?; @@ -120,7 +125,7 @@ fn execute() -> anyhow::Result<()> { log::debug!(target: "node", "Removing existing control socket.."); fs::remove_file(home.socket()).ok(); } - Runtime::init(home, config, options.listen, proxy, daemon, signals, signer)?.run()?; + Runtime::init(home, config, listen, proxy, daemon, signals, signer)?.run()?; Ok(()) } diff --git a/radicle/src/node/config.rs b/radicle/src/node/config.rs index 92c7234a..0b4da321 100644 --- a/radicle/src/node/config.rs +++ b/radicle/src/node/config.rs @@ -1,4 +1,5 @@ use std::collections::HashSet; +use std::net; use std::ops::Deref; use cyphernet::addr::PeerAddr; @@ -165,6 +166,9 @@ impl Default for PeerConfig { pub struct Config { /// Node alias. pub alias: Alias, + /// Address to listen on. + #[serde(default)] + pub listen: Vec, /// Peer configuration. #[serde(default)] pub peers: PeerConfig, @@ -204,6 +208,7 @@ impl Config { Self { alias, peers: PeerConfig::default(), + listen: vec![], connect: HashSet::default(), external_addresses: vec![], network: Network::default(),