diff --git a/src/types/config.rs b/src/types/config.rs index 84b86f2..f28e1da 100644 --- a/src/types/config.rs +++ b/src/types/config.rs @@ -27,7 +27,10 @@ impl DaemonConfig { pub fn load_from_file() -> Result> { let config_path = get_config_path()?.join("daemon.json"); let bytes = fs::read(config_path)?; - Ok(serde_json::from_slice::(&bytes)?) + match serde_json::from_slice::(&bytes) { + Ok(config) => Ok(config), + Err(_) => Ok(DaemonConfig::default()), + } } } @@ -84,6 +87,9 @@ impl GuiConfig { pub fn load_from_file() -> Result> { let config_path = get_config_path()?.join("gui.json"); let bytes = fs::read(config_path)?; - Ok(serde_json::from_slice::(&bytes)?) + match serde_json::from_slice::(&bytes) { + Ok(config) => Ok(config), + Err(_) => Ok(GuiConfig::default()), + } } }