import os from pathlib import Path # Application package lives under `src/`; repo root is one level up (for `.env`, default workspace). BASE_DIR = Path(__file__).resolve().parent.parent PROJECT_ROOT = BASE_DIR.parent STATIC_DIR = BASE_DIR / "static" def load_env_file(env_path: Path) -> None: """Load KEY=VALUE entries from a local .env file (does not override existing os.environ).""" if not env_path.exists(): return for line in env_path.read_text(encoding="utf-8").splitlines(): stripped = line.strip() if not stripped or stripped.startswith("#") or "=" not in stripped: continue key, value = stripped.split("=", 1) key = key.strip() value = value.strip().strip('"').strip("'") if key and key not in os.environ: os.environ[key] = value load_env_file(PROJECT_ROOT / ".env") _default_workspace = PROJECT_ROOT / "workspace" WORKSPACE_ROOT = Path(os.environ.get("WORKSPACE_ROOT", str(_default_workspace))).resolve()