Nicolas Cantu 088eab84b7 Platform docs, services, ia_dev submodule, smart_ide project config
- Add ia_dev submodule (projects/smart_ide on forge 4nk)
- Document APIs, orchestrator, gateway, local-office, rollout
- Add systemd/scripts layout; relocate setup scripts
- Remove obsolete nginx/enso-only docs from this repo scope
2026-04-03 16:07:58 +02:00

47 lines
1.2 KiB
Python

"""Load configuration from environment. No secrets in repo."""
import os
from pathlib import Path
from dotenv import load_dotenv
load_dotenv()
def _env(key: str, default: str | None = None) -> str:
val = os.environ.get(key)
if val is not None:
return val.strip()
if default is not None:
return default
raise ValueError(f"Missing required env: {key}")
def get_api_keys() -> list[str]:
"""Comma-separated API keys. At least one required."""
raw = _env("API_KEYS", "")
if not raw:
raise ValueError("API_KEYS must be set (comma-separated list)")
return [k.strip() for k in raw.split(",") if k.strip()]
def get_storage_path() -> Path:
"""Directory for document files."""
p = Path(_env("STORAGE_PATH", "./data/files"))
return p.resolve()
def get_database_path() -> Path:
"""SQLite database path for metadata."""
p = Path(_env("DATABASE_PATH", "./data/local_office.db"))
return p.resolve()
def get_max_upload_bytes() -> int:
"""Max upload size in bytes."""
return int(_env("MAX_UPLOAD_BYTES", "20971520"))
def get_rate_limit_per_minute() -> int:
"""Rate limit per API key per minute."""
return int(_env("RATE_LIMIT_PER_MINUTE", "60"))