"""Minimal .env loader (architecture L12: secrets from env/.env, nothing hardcoded). Deliberately tiny: KEY=VALUE lines, comments and blanks ignored, existing environment variables never overridden (real env wins over the file). """ import os from collections.abc import MutableMapping from pathlib import Path def load_env_file(path: Path, env: MutableMapping[str, str] = os.environ) -> None: if not path.exists(): return for line in path.read_text().splitlines(): line = line.strip() if not line or line.startswith("#") or "=" not in line: continue key, value = line.split("=", 1) key = key.strip() if key and key not in env: env[key] = value.strip()