env
diapason.core.env
¶
Environment variables — one idiom, with backward compatibility.
The project was renamed OpenJarvis → Diapason, so the variables become
DIAPASON_*. Renaming them outright would break every existing setup
SILENTLY: a shell profile, a CI job or a systemd unit exporting
OPENJARVIS_HOME would simply stop being read, with no error — the worst
possible failure mode for a configuration contract.
So each variable is read through :func:get, which tries, in order:
DIAPASON_<NAME>— the new name, always wins;- the legacy name(s) —
OPENJARVIS_<NAME>and/orJARVIS_<NAME>.
A legacy hit is logged once at DEBUG with the new name to migrate to, so the old spelling keeps working while telling you it is old.
get(name, default=None)
¶
Return DIAPASON_<name>, falling back to the legacy spellings.
name is the bare suffix: get("HOME") reads DIAPASON_HOME, then
OPENJARVIS_HOME, then JARVIS_HOME.
is_set(name)
¶
True when the variable is set under any accepted spelling.
names(name)
¶
Every spelling read for name, new first — handy for diagnostics.