Parse http CLI args for HTTP server

This commit is contained in:
Paul Hauner
2019-05-28 13:50:51 +10:00
parent 2a04da8bf7
commit 3f27fd4edf
4 changed files with 53 additions and 14 deletions

View File

@@ -140,6 +140,19 @@ impl ClientConfig {
}
}
/* HTTP related arguments */
if args.is_present("http") {
config.http_conf.enabled = true;
}
if let Some(listen_address) = args.value_of("http-address") {
config.http_conf.listen_address = listen_address.to_string();
}
if let Some(listen_port) = args.value_of("http-port") {
config.http_conf.listen_port = listen_port.to_string();
}
match args.value_of("db") {
Some("disk") => config.db_type = DBType::Disk,
Some("memory") => config.db_type = DBType::Memory,

View File

@@ -115,13 +115,17 @@ where
// Start the `http_server` service.
//
// Note: presently we are ignoring the config and _always_ starting a HTTP server.
let http_exit_signal = Some(http_server::start_service(
&config.http_conf,
executor,
network_send,
beacon_chain.clone(),
&log,
));
let http_exit_signal = if config.http_conf.enabled {
Some(http_server::start_service(
&config.http_conf,
executor,
network_send,
beacon_chain.clone(),
&log,
))
} else {
None
};
let (slot_timer_exit_signal, exit) = exit_future::signal();
if let Ok(Some(duration_to_next_slot)) = beacon_chain.slot_clock.duration_to_next_slot() {