diff --git a/mixnode/src/commands/init.rs b/mixnode/src/commands/init.rs index 4edba5ecd0..b356832dd5 100644 --- a/mixnode/src/commands/init.rs +++ b/mixnode/src/commands/init.rs @@ -37,7 +37,19 @@ pub fn command_args<'a, 'b>() -> clap::App<'a, 'b> { .arg( Arg::with_name(MIX_PORT_ARG_NAME) .long(MIX_PORT_ARG_NAME) - .help("The port on which the mixnode will be listening") + .help("The port on which the mixnode will be listening for mix packets") + .takes_value(true), + ) + .arg( + Arg::with_name(VERLOC_PORT_ARG_NAME) + .long(VERLOC_PORT_ARG_NAME) + .help("The port on which the mixnode will be listening for verloc packets") + .takes_value(true), + ) + .arg( + Arg::with_name(HTTP_API_PORT_ARG_NAME) + .long(HTTP_API_PORT_ARG_NAME) + .help("The port on which the mixnode will be listening for http requests") .takes_value(true), ) .arg( diff --git a/mixnode/src/commands/mod.rs b/mixnode/src/commands/mod.rs index 0cd690220b..97e49a4d46 100644 --- a/mixnode/src/commands/mod.rs +++ b/mixnode/src/commands/mod.rs @@ -15,6 +15,8 @@ pub(crate) const ID_ARG_NAME: &str = "id"; pub(crate) const HOST_ARG_NAME: &str = "host"; pub(crate) const LAYER_ARG_NAME: &str = "layer"; pub(crate) const MIX_PORT_ARG_NAME: &str = "mix-port"; +pub(crate) const VERLOC_PORT_ARG_NAME: &str = "verloc-port"; +pub(crate) const HTTP_API_PORT_ARG_NAME: &str = "http-api-port"; pub(crate) const VALIDATORS_ARG_NAME: &str = "validators"; pub(crate) const CONTRACT_ARG_NAME: &str = "mixnet-contract"; pub(crate) const ANNOUNCE_HOST_ARG_NAME: &str = "announce-host"; @@ -58,6 +60,28 @@ pub(crate) fn override_config(mut config: Config, matches: &ArgMatches) -> Confi config = config.with_mix_port(port.unwrap()); } + if let Some(port) = matches + .value_of(VERLOC_PORT_ARG_NAME) + .map(|port| port.parse::()) + { + if let Err(err) = port { + // if port was overridden, it must be parsable + panic!("Invalid verloc port value provided - {:?}", err); + } + config = config.with_verloc_port(port.unwrap()); + } + + if let Some(port) = matches + .value_of(HTTP_API_PORT_ARG_NAME) + .map(|port| port.parse::()) + { + if let Err(err) = port { + // if port was overridden, it must be parsable + panic!("Invalid http api port value provided - {:?}", err); + } + config = config.with_http_api_port(port.unwrap()); + } + if let Some(raw_validators) = matches.value_of(VALIDATORS_ARG_NAME) { config = config.with_custom_validators(parse_validators(raw_validators)); } diff --git a/mixnode/src/commands/run.rs b/mixnode/src/commands/run.rs index be4fd76355..870e351d71 100644 --- a/mixnode/src/commands/run.rs +++ b/mixnode/src/commands/run.rs @@ -37,7 +37,19 @@ pub fn command_args<'a, 'b>() -> App<'a, 'b> { .arg( Arg::with_name(MIX_PORT_ARG_NAME) .long(MIX_PORT_ARG_NAME) - .help("The port on which the mixnode will be listening") + .help("The port on which the mixnode will be listening for mix packets") + .takes_value(true), + ) + .arg( + Arg::with_name(VERLOC_PORT_ARG_NAME) + .long(VERLOC_PORT_ARG_NAME) + .help("The port on which the mixnode will be listening for verloc packets") + .takes_value(true), + ) + .arg( + Arg::with_name(HTTP_API_PORT_ARG_NAME) + .long(HTTP_API_PORT_ARG_NAME) + .help("The port on which the mixnode will be listening for http requests") .takes_value(true), ) .arg(