mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2025-01-06 02:52:20 +00:00
112 lines
3.5 KiB
Rust
112 lines
3.5 KiB
Rust
extern crate slog;
|
|
|
|
mod run;
|
|
|
|
use clap::{App, Arg};
|
|
use client::ClientConfig;
|
|
use slog::{crit, 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")
|
|
// file system related arguments
|
|
.arg(
|
|
Arg::with_name("datadir")
|
|
.long("datadir")
|
|
.value_name("DIR")
|
|
.help("Data directory for keys and databases.")
|
|
.takes_value(true),
|
|
)
|
|
// network related arguments
|
|
.arg(
|
|
Arg::with_name("listen-address")
|
|
.long("listen-address")
|
|
.value_name("Listen Address")
|
|
.help("One or more comma-delimited multi-addresses to listen for p2p connections.")
|
|
.takes_value(true),
|
|
)
|
|
.arg(
|
|
Arg::with_name("boot-nodes")
|
|
.long("boot-nodes")
|
|
.value_name("BOOTNODES")
|
|
.help("One or more comma-delimited multi-addresses to bootstrap the p2p network.")
|
|
.takes_value(true),
|
|
)
|
|
// rpc related arguments
|
|
.arg(
|
|
Arg::with_name("rpc")
|
|
.long("rpc")
|
|
.value_name("RPC")
|
|
.help("Enable the RPC server.")
|
|
.takes_value(false),
|
|
)
|
|
.arg(
|
|
Arg::with_name("rpc-address")
|
|
.long("rpc-address")
|
|
.value_name("RPCADDRESS")
|
|
.help("Listen address for RPC endpoint.")
|
|
.takes_value(true),
|
|
)
|
|
.arg(
|
|
Arg::with_name("rpc-port")
|
|
.long("rpc-port")
|
|
.value_name("RPCPORT")
|
|
.help("Listen port for RPC endpoint.")
|
|
.takes_value(true),
|
|
)
|
|
// HTTP related arguments
|
|
.arg(
|
|
Arg::with_name("http")
|
|
.long("http")
|
|
.value_name("HTTP")
|
|
.help("Enable the HTTP server.")
|
|
.takes_value(false),
|
|
)
|
|
.arg(
|
|
Arg::with_name("http-address")
|
|
.long("http-address")
|
|
.value_name("HTTPADDRESS")
|
|
.help("Listen address for the HTTP server.")
|
|
.takes_value(true),
|
|
)
|
|
.arg(
|
|
Arg::with_name("http-port")
|
|
.long("http-port")
|
|
.value_name("HTTPPORT")
|
|
.help("Listen port for the HTTP server.")
|
|
.takes_value(true),
|
|
)
|
|
.arg(
|
|
Arg::with_name("db")
|
|
.long("db")
|
|
.value_name("DB")
|
|
.help("Type of database to use.")
|
|
.takes_value(true)
|
|
.possible_values(&["disk", "memory"])
|
|
.default_value("memory"),
|
|
)
|
|
.get_matches();
|
|
|
|
let mut config = ClientConfig::default();
|
|
|
|
match config.apply_cli_args(&matches) {
|
|
Ok(()) => (),
|
|
Err(s) => {
|
|
crit!(logger, "Failed to parse CLI arguments"; "error" => s);
|
|
return;
|
|
}
|
|
};
|
|
|
|
match run::run_beacon_node(config, &logger) {
|
|
Ok(_) => {}
|
|
Err(e) => crit!(logger, "Beacon node failed to start"; "reason" => format!("{:}", e)),
|
|
}
|
|
}
|