simplify check logic

pull/4594/head
jim-taylor-business 2 months ago
parent ce6bc72b29
commit f53863dbb6

@ -13,12 +13,10 @@ use structs::{DatabaseConnection, PictrsConfig, PictrsImageMode, Settings};
static DEFAULT_CONFIG_FILE: &str = "config/config.hjson";
pub static SETTINGS: Lazy<Settings> = Lazy::new(|| {
if let Ok(value) = env::var("LEMMY_INITIALIZE_WITH_DEFAULT_SETTINGS") {
if value.eq("true") {
println!("LEMMY_INITIALIZE_WITH_DEFAULT_SETTINGS was set to `true`, any configuration file has been ignored");
println!("Use with other environment variables to configure this instance further, e.g. LEMMY_DATABASE_URL");
return Settings::default();
}
if env::var("LEMMY_INITIALIZE_WITH_DEFAULT_SETTINGS").is_ok() {
println!("LEMMY_INITIALIZE_WITH_DEFAULT_SETTINGS was set, any configuration file has been ignored");
println!("Use with other environment variables to configure this instance further; e.g. LEMMY_DATABASE_URL");
return Settings::default();
}
Settings::init().expect("Failed to load settings file, see documentation (https://join-lemmy.org/docs/en/administration/configuration.html)")
});

Loading…
Cancel
Save