lighthouse/beacon_node/src/main.rs

81 lines
2.5 KiB
Rust
Raw Normal View History

extern crate slog;
mod run;
use clap::{App, Arg};
use client::ClientConfig;
2019-03-19 11:53:51 +00:00
use slog::{error, o, Drain};
fn main() {
let decorator = slog_term::TermDecorator::new().build();
let drain = slog_term::CompactFormat::new(decorator).build().fuse();
let drain = slog_async::Async::new(drain).build().fuse();
let logger = slog::Logger::root(drain, o!());
let matches = App::new("Lighthouse")
.version(version::version().as_str())
.author("Sigma Prime <contact@sigmaprime.io>")
.about("Eth 2.0 Client")
2019-04-01 01:14:44 +00:00
// file system related arguments
.arg(
Arg::with_name("datadir")
.long("datadir")
.value_name("DIR")
.help("Data directory for keys and databases.")
.takes_value(true),
)
2019-04-01 01:14:44 +00:00
// network related arguments
.arg(
Arg::with_name("listen_address")
2019-03-19 22:58:31 +00:00
.long("listen-address")
.value_name("Listen Address")
.help("The Network address to listen for p2p connections.")
.takes_value(true),
)
.arg(
Arg::with_name("port")
.long("port")
.value_name("PORT")
.help("Network listen port for p2p connections.")
.takes_value(true),
)
2019-04-01 01:14:44 +00:00
.arg(
Arg::with_name("boot-nodes")
.long("boot-nodes")
.value_name("BOOTNODES")
.help("A list of comma separated multi addresses representing bootnodes to connect to.")
.takes_value(true),
)
// rpc related arguments
2019-03-19 13:01:00 +00:00
.arg(
Arg::with_name("rpc")
2019-03-19 22:58:31 +00:00
.long("rpc")
2019-03-19 13:01:00 +00:00
.value_name("RPC")
.help("Enable the RPC server.")
.takes_value(false),
)
.arg(
Arg::with_name("rpc-address")
2019-03-19 22:58:31 +00:00
.long("rpc-address")
2019-03-19 13:01:00 +00:00
.value_name("RPCADDRESS")
.help("Listen address for RPC endpoint.")
.takes_value(true),
)
.arg(
Arg::with_name("rpc-port")
2019-03-19 22:58:31 +00:00
.long("rpc-port")
2019-03-19 13:01:00 +00:00
.value_name("RPCPORT")
.help("Listen port for RPC endpoint.")
.takes_value(true),
)
.get_matches();
// invalid arguments, panic
let config = ClientConfig::parse_args(matches, &logger).unwrap();
2019-03-19 11:53:51 +00:00
match run::run_beacon_node(config, &logger) {
Ok(_) => {}
Err(e) => error!(logger, "Beacon node failed because {:?}", e),
}
}