Actually using proper config
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
use crate::commands::override_config;
|
||||
use crate::config::Config;
|
||||
use crate::validator;
|
||||
use crate::validator::Validator;
|
||||
use clap::{App, Arg, ArgMatches};
|
||||
use config::NymConfig;
|
||||
@@ -30,17 +29,10 @@ pub fn command_args<'a, 'b>() -> clap::App<'a, 'b> {
|
||||
)
|
||||
}
|
||||
|
||||
fn parse_old_config(matches: &ArgMatches) -> validator::Config {
|
||||
let config_file_path = matches.value_of("config").unwrap();
|
||||
// since this is happening at the very startup, it's fine to panic if file doesn't exist
|
||||
let config_content = std::fs::read_to_string(config_file_path).unwrap();
|
||||
toml::from_str(&config_content).unwrap()
|
||||
}
|
||||
|
||||
pub fn execute(matches: &ArgMatches) {
|
||||
let id = matches.value_of("id").unwrap();
|
||||
|
||||
println!("Starting sfw-provider {}...", id);
|
||||
println!("Starting validator {}...", id);
|
||||
|
||||
let mut config =
|
||||
Config::load_from_file(matches.value_of("config").map(|path| path.into()), Some(id))
|
||||
@@ -48,8 +40,6 @@ pub fn execute(matches: &ArgMatches) {
|
||||
|
||||
config = override_config(config, matches);
|
||||
|
||||
let old_config = parse_old_config(matches);
|
||||
|
||||
let validator = Validator::new(old_config);
|
||||
let validator = Validator::new(config);
|
||||
validator.start()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user