pub struct SettingsEnv { /* private fields */ }Expand description
An EnvSource with the settings/profile
fallback — the value form of get_env_var.
Reads the real process environment first, then the active profile’s env
(or the base env when no profile is active) in
$HOME/.omni-dev/settings.json.
Pass &SettingsEnv::load() from a thin production wrapper; tests inject a
pure MapEnv into the same *_with(&impl EnvSource, …) seam instead of
mutating the process environment.
Implementations§
Source§impl SettingsEnv
impl SettingsEnv
Sourcepub fn load() -> Self
pub fn load() -> Self
Loads settings from the default location, falling back to an empty
settings map if they are absent or unreadable (env-only behaviour). The
active profile is read from OMNI_DEV_PROFILE.
Sourcepub fn load_with_profile(profile: Option<&str>) -> Self
pub fn load_with_profile(profile: Option<&str>) -> Self
Like load but with the active profile supplied
explicitly — for tests and embedders that select a profile without
setting OMNI_DEV_PROFILE in the process environment.
Sourcepub fn from_settings(settings: Settings, profile: Option<&str>) -> Self
pub fn from_settings(settings: Settings, profile: Option<&str>) -> Self
Wraps an already-loaded Settings, skipping the disk read/parse
load/load_with_profile
perform — for callers (e.g. load_credentials_for/status_for in
crate::gmail::auth/crate::drive::auth) that already loaded
Settings to resolve an account and would otherwise discard it just
to re-read the same file a second time (issue #1533).