diff --git a/crates/utils/src/settings/mod.rs b/crates/utils/src/settings/mod.rs index d47cc5b4b..7e320701d 100644 --- a/crates/utils/src/settings/mod.rs +++ b/crates/utils/src/settings/mod.rs @@ -6,7 +6,7 @@ use std::{env, fs, io::Error, sync::RwLock}; pub mod structs; -static CONFIG_FILE: &str = "config/config.hjson"; +static DEFAULT_CONFIG_FILE: &str = "config/config.hjson"; lazy_static! { static ref SETTINGS: RwLock = @@ -54,7 +54,7 @@ impl Settings { } pub fn get_config_location() -> String { - env::var("LEMMY_CONFIG_LOCATION").unwrap_or_else(|_| CONFIG_FILE.to_string()) + env::var("LEMMY_CONFIG_LOCATION").unwrap_or_else(|_| DEFAULT_CONFIG_FILE.to_string()) } pub fn read_config_file() -> Result { @@ -92,7 +92,7 @@ impl Settings { } pub fn save_config_file(data: &str) -> Result { - fs::write(CONFIG_FILE, data)?; + fs::write(Settings::get_config_location(), data)?; // Reload the new settings // From https://stackoverflow.com/questions/29654927/how-do-i-assign-a-string-to-a-mutable-static-variable/47181804#47181804