fix: JWT_SECRET lazy-validiert statt beim Import

config.py: get_jwt_secret() wirft RuntimeError nur bei Nutzung,
nicht beim Import. Blog-Pipeline kann importieren ohne JWT_SECRET,
Monitor bleibt geschützt.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Dieser Commit ist enthalten in:
Claude Dev
2026-03-29 13:53:17 +02:00
Ursprung 5bcaa4e8a1
Commit c53d441c69
2 geänderte Dateien mit 13 neuen und 4 gelöschten Zeilen

Datei anzeigen

@@ -13,7 +13,16 @@ STATIC_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "static")
DB_PATH = os.path.join(DATA_DIR, "osint.db")
# JWT
JWT_SECRET = os.environ.get("JWT_SECRET", "")
_JWT_SECRET = os.environ.get("JWT_SECRET", "")
def get_jwt_secret() -> str:
"""Gibt JWT_SECRET zurück. Wirft RuntimeError wenn nicht gesetzt."""
if not _JWT_SECRET:
raise RuntimeError("JWT_SECRET Umgebungsvariable muss gesetzt sein")
return _JWT_SECRET
# Rückwärtskompatibel für direkte Imports
JWT_SECRET = _JWT_SECRET
JWT_ALGORITHM = "HS256"
JWT_EXPIRE_HOURS = 24