Files
RollCalculator/With Authentification/config_prod.py
T
2026-05-28 14:55:09 +02:00

69 lines
2.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
Naue Roll Calculator – Production Configuration Template
Nutze diese Datei als Vorlage für Produktionsumgebungen.
Speichere sensible Daten in Umgebungsvariablen oder verschlüsselten Config-Files!
"""
import os
from datetime import timedelta
# ============================================================================
# ENVIRONMENT
# ============================================================================
ENV = os.getenv("FLASK_ENV", "production")
DEBUG = os.getenv("DEBUG", "False").lower() == "true"
# ============================================================================
# AUTHENTICATION
# ============================================================================
# Benutzer aus Umgebungsvariablen laden (Docker/K8s)
BETA_USERS = {
os.getenv("BETA_USER_1", "beta"): os.getenv("BETA_PASS_1", "changeme"),
}
ADMIN_USERS = {
os.getenv("ADMIN_USER", "admin"): os.getenv("ADMIN_PASS", "changeme"),
}
# ============================================================================
# SECURITY
# ============================================================================
SECRET_KEY = os.getenv("SECRET_KEY", "CHANGE_ME_IN_PRODUCTION")
SESSION_COOKIE_SECURE = True # HTTPS only
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_SAMESITE = "Lax"
PERMANENT_SESSION_LIFETIME = timedelta(hours=8)
# ============================================================================
# LOGGING
# ============================================================================
LOG_FILE = os.getenv("LOG_FILE", "access_log.json")
LOG_ROTATION = os.getenv("LOG_ROTATION", "daily") # daily, weekly, monthly
# ============================================================================
# RATE LIMITING (optional)
# ============================================================================
RATELIMIT_ENABLED = os.getenv("RATELIMIT_ENABLED", "True").lower() == "true"
RATELIMIT_DEFAULT = "100 per hour" # Max 100 requests pro Stunde
# ============================================================================
# MONITORING
# ============================================================================
SENTRY_DSN = os.getenv("SENTRY_DSN", None) # Optional: Error Tracking
DATADOG_ENABLED = os.getenv("DATADOG_ENABLED", "False").lower() == "true"
# ============================================================================
# DATABASE (falls später benötigt)
# ============================================================================
DB_URL = os.getenv("DATABASE_URL", None)
print(f"[Config] Environment: {ENV}, Debug: {DEBUG}")