Skip to main content

Module settings

Module settings 

Source
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 own env map, selected per invocation via --profile / OMNI_DEV_PROFILE.
Settings
Settings loaded from $HOME/.omni-dev/settings.json.
SettingsEnv
An EnvSource with the settings/profile fallback — the value form of get_env_var.

Enums§

EnvValueSource
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), or None when OMNI_DEV_PROFILE is unset or empty.
exported_by_cli_flag
Returns whether key was 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 key was exported into the process environment by a command-line flag, so get_env_var_sourced reports EnvValueSource::CliFlag for it instead of EnvValueSource::ProcessEnv.
profile_suffix
Renders (profile '<name>') for credential-store CLI messages, or the empty string when no profile is active — so auth login/logout output names the env map it actually wrote to (issue #1116).