Files
computer-playbook/cli/meta/env/__main__.py
T
kevinveenbirkenbachandClaude Opus 4.7 12a56e449d refactor(env): move env/default.env to repo-root default.env and drop env/
With env.development and env/ci.env both gone, env/default.env was the
last inhabitant of the directory. Hoisting it to the repo root removes
the empty-shell indirection: the SPOT is now [default.env](default.env),
sitting next to .env (its generated companion) and other repo-root
configuration artefacts like compose.yml, Dockerfile, and Makefile.

Path updates land in:
- generator: cli/meta/env/__main__.py (REPO_ROOT / "default.env")
- workflow: .github/workflows/test-install-make.yml (awk reads from
  default.env, error message updated in lockstep)
- lint tests: test_used_keys_declared.py and test_infinito_prefix.py
  switched from globbing env/*.env to targeting default.env directly;
  test_default_env_keys_handled.py points at the new path
- drift test: test_inventory_vars_file_spot.py whitelist + STATIC_ENV
- smoke test: tests/integration/meta/env/test_dotenv_generator.py
  STATIC_ENV + every docstring/error message

Doc-string and prose references in utils/env/*, scripts/*,
cli/administration/deploy/development/{common,coredns}.py,
Makefile, Dockerfile, and every doc page that mentioned env/default.env
are rewritten in the same pass so future readers see one path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 16:22:33 +02:00

34 lines
877 B
Python

"""CLI entry: `python -m cli.meta.env` (also `make dotenv`)."""
from __future__ import annotations
import sys
from utils.env.builder import build_env
from utils.env.parser import parse_static_env_with_comments
from utils.env.writer import write_dotenv
from . import PROJECT_ROOT as REPO_ROOT
def main() -> int:
static_path = REPO_ROOT / "default.env"
out_path = REPO_ROOT / ".env"
if not static_path.is_file():
print(f"ERROR: missing {static_path}", file=sys.stderr)
return 2
static, static_comments = parse_static_env_with_comments(static_path)
eb = build_env(static, repo_root=REPO_ROOT, comments=static_comments)
write_dotenv(eb, out_path)
print(
f"Wrote {out_path.relative_to(REPO_ROOT)} ({len(eb.values)} variables)",
file=sys.stderr,
)
return 0
if __name__ == "__main__":
sys.exit(main())