Expand description
Settings and configuration utilities.
This module provides functionality to read settings from $HOME/.omni-dev/settings.json and use them as a fallback for environment variables.
It also owns the write side: Settings::upsert_env_vars_in and
Settings::remove_env_vars_in (plus their base-env shorthands
Settings::upsert_env_vars / Settings::remove_env_vars) are the only
production paths that mutate the settings file. Writes target the active
profile’s env when a profile is given, mirroring the read-side isolation
of Settings::resolve_with (issue #1116). Because the env maps hold
credentials (Atlassian, Datadog), every write is hardened: parent directory
0700, file 0600, re-tightened on each write (issue #1128).
Structs§
- Profile
- A named credential/config bundle inside
settings.json— its ownenvmap, selected per invocation via--profile/OMNI_DEV_PROFILE. - Settings
- Settings loaded from $HOME/.omni-dev/settings.json.
- Settings
Env - An
EnvSourcewith the settings/profile fallback — the value form ofget_env_var.
Enums§
- EnvValue
Source - Where a resolved environment value came from, for provenance reporting (issue #1143).
Constants§
- PROFILE_
ENV_ VAR - Environment variable that selects the active profile, mirroring
AWS_PROFILE.
Functions§
- active_
profile_ from - Returns the active profile name from
raw(the process environment), orNonewhenOMNI_DEV_PROFILEis unset or empty. - exported_
by_ cli_ flag - Returns whether
keywas exported by a command-line flag this invocation. - get_
env_ var - Returns an environment variable with fallback to settings, honouring the
active profile from
OMNI_DEV_PROFILE. - get_
env_ var_ sourced - Like
get_env_var, but also reports where the value came from. - get_
env_ vars - Tries multiple environment variables with fallback to settings.
- note_
cli_ flag_ export - Records that
keywas exported into the process environment by a command-line flag, soget_env_var_sourcedreportsEnvValueSource::CliFlagfor it instead ofEnvValueSource::ProcessEnv. - profile_
suffix - Renders
(profile '<name>')for credential-store CLI messages, or the empty string when no profile is active — soauth login/logoutoutput names the env map it actually wrote to (issue #1116).