Files
wiki-tcg/backend/config.py
2026-03-18 15:33:24 +01:00

21 lines
711 B
Python

import os
def require(key: str) -> str:
value = os.environ.get(key)
if not value:
raise RuntimeError(f"Required environment variable {key} is not set")
return value
def optional(key: str, default: str = "") -> str:
return os.environ.get(key, default)
# Required
JWT_SECRET_KEY = require("JWT_SECRET_KEY")
DATABASE_URL = require("DATABASE_URL")
RESEND_API_KEY = require("RESEND_API_KEY")
EMAIL_FROM = require("EMAIL_FROM")
# Optional with sensible defaults for local dev
FRONTEND_URL = optional("FRONTEND_URL", "http://localhost:5173")
CORS_ORIGINS = optional("CORS_ORIGINS", "http://localhost:5173").split(",")
WIKIRANK_USER_AGENT = optional("WIKIRANK_USER_AGENT", "WikiTCG/1.0")