e15eea067b
P5 final-review-ship complete: dual-read fallback removed (REQ-164) — core/env.py NOVA-only, .env.secrets load paths NOVA-only (G-106 retired), nova_tagging.py hard-fails any acdl:* tag, legacy ACDL_* Gitea secrets deleted, ACDL_LIFECYCLE_MODE/ACDL_LOCAL_TIER/ACDL_HITL_* exports removed from scripts, SNS subject → Nova SoD halt (P1-2), bootstrap scripts NOVA-only. Review: 2 P0 auto-fixed (duplicate delenv), P1-1/P1-2 resolved, doc-drift fixed. Audit: tags v1.15.0-4 exist; traceability REQ-155..164 all complete; ARCHITECTURE naming table matches codebase. 615 pytest PASS; run_ci.sh 3-stage PASS. NOVA_MIGRATION.md marked COMPLETE. ---ci--- project: acdl phase: 5 milestone: v1.15 status: complete phase_role: final requirements: covered: [REQ-155, REQ-156, REQ-157, REQ-158, REQ-159, REQ-160, REQ-161, REQ-162, REQ-163, REQ-164] partial: [] ---/ci---
31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
"""Environment helper (D-108, REQ-159, REQ-164).
|
||
|
||
During the Nova rebrand transition window (P2–P4), `get_env` read
|
||
`NOVA_*` preferred with the legacy `ACDL_*` name as the fallback. **P5
|
||
(REQ-164) removed the fallback** — `get_env` now reads `NOVA_*` only.
|
||
|
||
`get_env(name, default=None)` resolves `NOVA_<name>`, then returns
|
||
`default` if unset. Direct-read paths that bypass this helper (the
|
||
`.env.secrets` shell export in `scripts/run_platform.sh` and the Python
|
||
parser in `core/regression_verify.py`) were updated to NOVA-only in P5
|
||
(the G-106 dual-read contract was retired with the fallback).
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
import os
|
||
from typing import Optional
|
||
|
||
__all__ = ["get_env"]
|
||
|
||
|
||
def get_env(name: str, default: Optional[str] = None) -> Optional[str]:
|
||
"""Resolve a config value from the `NOVA_*` environment.
|
||
|
||
`name` is the bare key WITHOUT the prefix (e.g. ``"AWS_ACCOUNT_ID"``).
|
||
Returns ``NOVA_<name>`` if set and non-empty, else ``default``.
|
||
"""
|
||
val = os.environ.get(f"NOVA_{name}")
|
||
if val:
|
||
return val
|
||
return default |