Refactoring loading of config file
- let `HuskConfig::load` return a `Result` instead of an `Option`. - added comments
This commit is contained in:
+7
-7
@@ -17,13 +17,13 @@ use daemon::Daemon;
|
||||
async fn main() {
|
||||
|
||||
let config_file = env::args().nth(1).expect("config file missing");
|
||||
let husk_config = HuskConfig::load(&config_file);
|
||||
|
||||
if husk_config.is_none() {
|
||||
eprintln!("Cannot load configuration");
|
||||
process::exit(1);
|
||||
}
|
||||
let husk_config = husk_config.unwrap();
|
||||
let husk_config = match HuskConfig::load(&config_file) {
|
||||
Ok(config) => config,
|
||||
Err(e) => {
|
||||
eprintln!("{:?}", e);
|
||||
process::exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
log4rs::init_file(husk_config.logfile_config(), Default::default()).unwrap();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user