it-architecture/backend/app/config.py

22 lines
633 B
Python

"""Runtime configuration for the IT panorama service."""
from __future__ import annotations
import os
from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent.parent
DEFAULT_DB = BASE_DIR / "panorama.db"
def db_path() -> Path:
raw = os.environ.get("DB_PATH")
return Path(raw).expanduser().resolve() if raw else DEFAULT_DB
# Payload guard for the full-graph save endpoint.
MAX_BODY_BYTES = int(os.environ.get("MAX_BODY_BYTES", str(5 * 1024 * 1024)))
# Static frontend build produced by `pnpm build` inside ../frontend.
WEB_DIST = Path(os.environ.get("WEB_DIST", str(BASE_DIR.parent / "frontend" / "dist")))