1.0.0 Rework #25

Merged
Neshura merged 25 commits from v2 into main 2023-12-27 20:26:16 +00:00
Showing only changes of commit 445b22fecd - Show all commits

View file

@ -16,7 +16,10 @@ impl InterfaceConfig {
let cfg: Self = match confy::load(env!("CARGO_PKG_NAME"),"interfaces") { let cfg: Self = match confy::load(env!("CARGO_PKG_NAME"),"interfaces") {
Ok(data) => data, Ok(data) => data,
Err(e) => { Err(e) => {
error!("[ERROR] {}", e); match connected_to_journal() {
true => error!("[ERROR] {e}"),
false => eprintln!("[ERROR] {e}")
}
return Err(Box::new(e)); return Err(Box::new(e));
} }
}; };
@ -75,7 +78,11 @@ impl ZoneConfig {
let entry = entry?; let entry = entry?;
let path = entry.path(); let path = entry.path();
if path.is_dir() { if path.is_dir() {
warn!("[WARN] Subdirectory in zones.d detected, this should not be the case"); let warn_msg = "Subdirectory in zones.d detected, this should not be the case";
match connected_to_journal() {
true => warn!("[WARN] {warn_msg}"),
false => eprintln!("[WARN] {warn_msg}"),
}
} }
else { else {
let zone_config_path = format!("zones.d/{}", path.file_stem() let zone_config_path = format!("zones.d/{}", path.file_stem()
@ -84,7 +91,10 @@ impl ZoneConfig {
match confy::load(env!("CARGO_PKG_NAME"), zone_config_path.as_str()) { match confy::load(env!("CARGO_PKG_NAME"), zone_config_path.as_str()) {
Ok(data) => zone_configs.push(data), Ok(data) => zone_configs.push(data),
Err(e) => { Err(e) => {
error!("[ERROR] {}", e); match connected_to_journal() {
true => error!("[ERROR] {e}"),
false => eprintln!("[ERROR] {e}"),
}
return Err(Box::new(e)); return Err(Box::new(e));
} }
}; };