"""Lädt config.json (oder config.example.json) aus dem Projektordner.""" import json import os from pathlib import Path ROOT = Path(__file__).resolve().parents[2] DATA_DIR = Path(os.environ.get("P42_DATA_DIR") or ROOT / "data") FRONTEND_DIST = ROOT / "frontend" / "dist" def _load() -> dict: path = ROOT / "config.json" if not path.exists(): path = ROOT / "config.example.json" return json.loads(path.read_text(encoding="utf-8")) config = _load() PORT = int(config.get("port", 3000)) LINKS = config.get("links", {}) TRACKING = config.get("tracking", {}) # Wikimedia verlangt eine Kontaktangabe im User-Agent; leer = keine Wikipedia-Texte WIKIPEDIA_CONTACT = (config.get("reisen") or {}).get("wikipediaKontakt", "").strip()