mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-23 03:11:32 +00:00
Crash if config fails to load (#1545)
* Crash if config fails to load * fix previous commit
This commit is contained in:
parent
ebb980eaaf
commit
f0c96c28bf
1 changed files with 2 additions and 11 deletions
|
@ -13,7 +13,6 @@ use crate::{
|
||||||
};
|
};
|
||||||
use anyhow::{anyhow, Context};
|
use anyhow::{anyhow, Context};
|
||||||
use deser_hjson::from_str;
|
use deser_hjson::from_str;
|
||||||
use log::warn;
|
|
||||||
use merge::Merge;
|
use merge::Merge;
|
||||||
use std::{env, fs, io::Error, net::IpAddr, sync::RwLock};
|
use std::{env, fs, io::Error, net::IpAddr, sync::RwLock};
|
||||||
|
|
||||||
|
@ -23,16 +22,8 @@ pub mod structs;
|
||||||
static CONFIG_FILE: &str = "config/config.hjson";
|
static CONFIG_FILE: &str = "config/config.hjson";
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref SETTINGS: RwLock<Settings> = RwLock::new(match Settings::init() {
|
static ref SETTINGS: RwLock<Settings> =
|
||||||
Ok(c) => c,
|
RwLock::new(Settings::init().expect("Failed to load settings file"));
|
||||||
Err(e) => {
|
|
||||||
warn!(
|
|
||||||
"Couldn't load settings file, using default settings.\n{}",
|
|
||||||
e
|
|
||||||
);
|
|
||||||
Settings::default()
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Settings {
|
impl Settings {
|
||||||
|
|
Loading…
Reference in a new issue