mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-06-09 00:49:21 +00:00
implement env variable
This commit is contained in:
parent
dc1494bbdc
commit
c1e5e48184
|
@ -12,7 +12,18 @@ use structs::{DatabaseConnection, PictrsConfig, PictrsImageMode, Settings};
|
|||
|
||||
static DEFAULT_CONFIG_FILE: &str = "config/config.hjson";
|
||||
|
||||
pub static SETTINGS: Lazy<Settings> = Lazy::new(|| Settings::init().unwrap_or_default());
|
||||
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();
|
||||
}
|
||||
}
|
||||
Settings::init().expect("Failed to load settings file, see documentation (https://join-lemmy.org/docs/en/administration/configuration.html)")
|
||||
});
|
||||
|
||||
// pub static SETTINGS: Lazy<Settings> = Lazy::new(|| Settings::init().unwrap_or_default());
|
||||
|
||||
static WEBFINGER_REGEX: Lazy<Regex> = Lazy::new(|| {
|
||||
Regex::new(&format!(
|
||||
|
|
Loading…
Reference in a new issue