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

@@ -4,7 +4,7 @@ from datetime import datetime, timedelta
from jose import jwt, JWTError
from fastapi import Depends, HTTPException, status
from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
from config import JWT_SECRET, JWT_ALGORITHM, JWT_EXPIRE_HOURS, TIMEZONE
from config import get_jwt_secret, JWT_ALGORITHM, JWT_EXPIRE_HOURS, TIMEZONE
security = HTTPBearer()
@@ -36,7 +36,7 @@ def create_token(
"iat": now,
"exp": expire,
}
return jwt.encode(payload, JWT_SECRET, algorithm=JWT_ALGORITHM)
return jwt.encode(payload, get_jwt_secret(), algorithm=JWT_ALGORITHM)
def decode_token(token: str) -> dict:
@@ -44,7 +44,7 @@ def decode_token(token: str) -> dict:
try:
payload = jwt.decode(
token,
JWT_SECRET,
get_jwt_secret(),
algorithms=[JWT_ALGORITHM],
issuer=JWT_ISSUER,
audience=JWT_AUDIENCE,