]> Untitled Git - lemmy.git/commitdiff
Crash if config fails to load (#1545)
authorNutomic <me@nutomic.com>
Mon, 5 Apr 2021 14:23:32 +0000 (14:23 +0000)
committerGitHub <noreply@github.com>
Mon, 5 Apr 2021 14:23:32 +0000 (10:23 -0400)
* Crash if config fails to load

* fix previous commit

crates/utils/src/settings/mod.rs

index 0990a43ded26e66d9713a6d6d22a7e0c7f914abf..d052fec6c665c5db8dbef5c0eb9eca9f7041e6e8 100644 (file)
@@ -13,7 +13,6 @@ use crate::{
 };
 use anyhow::{anyhow, Context};
 use deser_hjson::from_str;
-use log::warn;
 use merge::Merge;
 use std::{env, fs, io::Error, net::IpAddr, sync::RwLock};
 
@@ -23,16 +22,8 @@ pub mod structs;
 static CONFIG_FILE: &str = "config/config.hjson";
 
 lazy_static! {
-  static ref SETTINGS: RwLock<Settings> = RwLock::new(match Settings::init() {
-    Ok(c) => c,
-    Err(e) => {
-      warn!(
-        "Couldn't load settings file, using default settings.\n{}",
-        e
-      );
-      Settings::default()
-    }
-  });
+  static ref SETTINGS: RwLock<Settings> =
+    RwLock::new(Settings::init().expect("Failed to load settings file"));
 }
 
 impl Settings {