f.debug_struct("LemmyError")
.field("message", &self.message)
.field("inner", &self.inner)
- .field("context", &"SpanTrace")
+ .field("context", &self.context)
.finish()
}
}
static DEFAULT_CONFIG_FILE: &str = "config/config.hjson";
-pub static SETTINGS: Lazy<Settings> =
- Lazy::new(|| Settings::init().expect("Failed to load settings file"));
+pub static SETTINGS: Lazy<Settings> = Lazy::new(|| {
+ Settings::init().expect("Failed to load settings file, see documentation (https://join-lemmy.org/docs/en/administration/configuration.html)")
+});
static WEBFINGER_REGEX: Lazy<Regex> = Lazy::new(|| {
Regex::new(&format!(
"^acct:([a-zA-Z0-9_]{{3,}})@{}$",
)
}
- pub fn get_config_location() -> String {
+ fn get_config_location() -> String {
env::var("LEMMY_CONFIG_LOCATION").unwrap_or_else(|_| DEFAULT_CONFIG_FILE.to_string())
}
- pub fn read_config_file() -> Result<String, Error> {
+ fn read_config_file() -> Result<String, Error> {
fs::read_to_string(Self::get_config_location())
}
}
#[derive(Debug, Deserialize, Serialize, Clone, SmartDefault, Document)]
-#[serde(default)]
+#[serde(default, deny_unknown_fields)]
pub struct PictrsConfig {
/// Address where pictrs is available (for image hosting)
#[default(Url::parse("http://localhost:8080").expect("parse pictrs url"))]
}
#[derive(Debug, Deserialize, Serialize, Clone, SmartDefault, Document)]
-#[serde(default)]
+#[serde(default, deny_unknown_fields)]
pub struct DatabaseConfig {
/// Username to connect to postgres
#[default("lemmy")]
}
#[derive(Debug, Deserialize, Serialize, Clone, Document, SmartDefault)]
+#[serde(deny_unknown_fields)]
pub struct EmailConfig {
/// Hostname and port of the smtp server
#[doku(example = "localhost:25")]
}
#[derive(Debug, Deserialize, Serialize, Clone, SmartDefault, Document)]
+#[serde(deny_unknown_fields)]
pub struct SetupConfig {
/// Username for the admin user
#[doku(example = "admin")]