Using a static for CONFIG_FILE again.

This commit is contained in:
Dessalines 2020-07-13 09:37:52 -04:00
parent 4dc8aea6dd
commit 02a0b59eb6

View file

@ -4,6 +4,7 @@ use std::{fs, io::Error, net::IpAddr, sync::RwLock};
use std::env; use std::env;
static CONFIG_FILE_DEFAULTS: &str = "config/defaults.hjson"; static CONFIG_FILE_DEFAULTS: &str = "config/defaults.hjson";
static CONFIG_FILE: &str = "config/config.hjson";
#[derive(Debug, Deserialize, Clone)] #[derive(Debug, Deserialize, Clone)]
pub struct Settings { pub struct Settings {
@ -116,7 +117,7 @@ impl Settings {
} }
pub fn get_config_location() -> String { pub fn get_config_location() -> String {
env::var("LEMMY_CONFIG_LOCATION").unwrap_or("config/config.hjson".to_string()) env::var("LEMMY_CONFIG_LOCATION").unwrap_or(CONFIG_FILE.to_string())
} }
pub fn read_config_file() -> Result<String, Error> { pub fn read_config_file() -> Result<String, Error> {