strip session-added comments
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
//! Deserializers for values that arrive as strings from the environment but
|
||||
//! may be native numbers/bools in a TOML file.
|
||||
|
||||
use std::fmt;
|
||||
use std::marker::PhantomData;
|
||||
use std::str::FromStr;
|
||||
@@ -68,12 +65,10 @@ impl Visitor<'_> for Flag {
|
||||
}
|
||||
}
|
||||
|
||||
/// `true` only for `true` or `1` (anything else is false, like the old readers).
|
||||
pub fn true_or_one<'de, D: Deserializer<'de>>(d: D) -> Result<bool, D::Error> {
|
||||
d.deserialize_any(Flag { accepts_one: true })
|
||||
}
|
||||
|
||||
/// `true` only for `true`.
|
||||
pub fn true_only<'de, D: Deserializer<'de>>(d: D) -> Result<bool, D::Error> {
|
||||
d.deserialize_any(Flag { accepts_one: false })
|
||||
}
|
||||
|
||||
@@ -10,8 +10,6 @@ use crate::errors::ConfigError;
|
||||
const DEFAULT_CONFIG_FILE: &str = "config.toml";
|
||||
const CONFIG_FILE_VARIABLE: &str = "CONFIG_FILE";
|
||||
|
||||
/// Every environment variable the application has always honoured, mapped to
|
||||
/// its `section.field` key. No prefix: the names are the public contract.
|
||||
const LEGACY_ENV: &[(&str, &str)] = &[
|
||||
("ALLOW_REGISTRATION", "server.allow_registration"),
|
||||
("BASE_URL", "server.base_url"),
|
||||
@@ -58,9 +56,6 @@ const LEGACY_ENV: &[(&str, &str)] = &[
|
||||
("WRAPUP_LOGO_PATH", "wrapup.logo_path"),
|
||||
];
|
||||
|
||||
/// Reads the legacy variables as plain strings; typing is left to the config
|
||||
/// structs so that e.g. `JWT_SECRET=12345` stays a string. Empty or
|
||||
/// whitespace-only values are skipped as unset.
|
||||
struct LegacyEnv;
|
||||
|
||||
impl Provider for LegacyEnv {
|
||||
@@ -77,8 +72,6 @@ impl Provider for LegacyEnv {
|
||||
let value = raw
|
||||
.into_string()
|
||||
.map_err(|_| figment::Error::from(format!("{variable} is not valid unicode")))?;
|
||||
// An empty value (`PORT=` in a .env template) means "not set": the
|
||||
// default applies, or the optional field stays `None`.
|
||||
if value.trim().is_empty() {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user