Correct cli rpc parameters

This commit is contained in:
Age Manning 2019-03-20 09:58:31 +11:00
parent 037c3b8307
commit 4be2eeb792
No known key found for this signature in database
GPG Key ID: 05EED64B79E06A93
3 changed files with 11 additions and 6 deletions

View File

@ -97,6 +97,10 @@ impl ClientConfig {
/* RPC related arguments */ /* RPC related arguments */
if args.is_present("rpc") {
config.rpc_conf.enabled = true;
}
if let Some(rpc_address) = args.value_of("rpc-address") { if let Some(rpc_address) = args.value_of("rpc-address") {
if let Ok(listen_address) = rpc_address.parse::<Ipv4Addr>() { if let Ok(listen_address) = rpc_address.parse::<Ipv4Addr>() {
config.rpc_conf.listen_address = listen_address; config.rpc_conf.listen_address = listen_address;

View File

@ -1,7 +1,6 @@
extern crate slog; extern crate slog;
mod client_config; mod client_config;
pub mod client_types; pub mod client_types;
pub mod error; pub mod error;
pub mod notifier; pub mod notifier;
@ -61,7 +60,9 @@ impl<TClientType: ClientTypes> Client<TClientType> {
)?; )?;
// spawn the RPC server // spawn the RPC server
rpc::start_server(&config.rpc_conf, &log); if config.rpc_conf.enabled {
rpc::start_server(&config.rpc_conf, &log);
}
Ok(Client { Ok(Client {
config, config,

View File

@ -25,7 +25,7 @@ fn main() {
) )
.arg( .arg(
Arg::with_name("listen_address") Arg::with_name("listen_address")
.long("listen_address") .long("listen-address")
.value_name("Listen Address") .value_name("Listen Address")
.help("The Network address to listen for p2p connections.") .help("The Network address to listen for p2p connections.")
.takes_value(true), .takes_value(true),
@ -39,21 +39,21 @@ fn main() {
) )
.arg( .arg(
Arg::with_name("rpc") Arg::with_name("rpc")
.long("Enable RPC") .long("rpc")
.value_name("RPC") .value_name("RPC")
.help("Enable the RPC server.") .help("Enable the RPC server.")
.takes_value(false), .takes_value(false),
) )
.arg( .arg(
Arg::with_name("rpc-address") Arg::with_name("rpc-address")
.long("rpc address") .long("rpc-address")
.value_name("RPCADDRESS") .value_name("RPCADDRESS")
.help("Listen address for RPC endpoint.") .help("Listen address for RPC endpoint.")
.takes_value(true), .takes_value(true),
) )
.arg( .arg(
Arg::with_name("rpc-port") Arg::with_name("rpc-port")
.long("rpc port") .long("rpc-port")
.value_name("RPCPORT") .value_name("RPCPORT")
.help("Listen port for RPC endpoint.") .help("Listen port for RPC endpoint.")
.takes_value(true), .takes_value(true),