Configuration updates allow for verbosity CLI flag and spec constants

This commit is contained in:
Age Manning
2019-08-07 14:54:08 +10:00
parent 107bbdcccd
commit 907a4e5a4b
5 changed files with 94 additions and 92 deletions

View File

@@ -1,3 +1,4 @@
use crate::Eth2Config;
use clap::ArgMatches;
use http_server::HttpServerConfig;
use network::NetworkConfig;
@@ -56,8 +57,6 @@ impl Default for Config {
log_file: PathBuf::from(""),
db_type: "disk".to_string(),
db_name: "chain_db".to_string(),
// Note: there are no default bootnodes specified.
// Once bootnodes are established, add them here.
network: NetworkConfig::new(),
rpc: rpc::RPCConfig::default(),
http: HttpServerConfig::default(),
@@ -129,6 +128,15 @@ impl Config {
self.data_dir = PathBuf::from(dir);
};
if let Some(default_spec) = args.value_of("default-spec") {
match default_spec {
"mainnet" => self.spec_constants = Eth2Config::mainnet().spec_constants,
"minimal" => self.spec_constants = Eth2Config::minimal().spec_constants,
"interop" => self.spec_constants = Eth2Config::interop().spec_constants,
_ => {} // not supported
}
}
if let Some(dir) = args.value_of("db") {
self.db_type = dir.to_string();
};