Refactoring loading of config file

- let `HuskConfig::load` return a `Result` instead of an `Option`.
- added comments
This commit is contained in:
Malte Meiboom
2026-01-05 12:32:30 +01:00
parent a56e933e80
commit b7e01a446c
7 changed files with 36 additions and 15 deletions
+7 -7
View File
@@ -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();