""" Dedalys Backend — Configuration Gestion centralisée des variables d'environnement. """ from typing import List from pydantic_settings import BaseSettings from dotenv import load_dotenv load_dotenv() class Settings(BaseSettings): """Configuration de l'application Dedalys.""" # ── Supabase ───────────────────────────────────────────── SUPABASE_URL: str SUPABASE_ANON_KEY: str SUPABASE_SERVICE_KEY: str SUPABASE_JWT_SECRET: str # MVP — conservé pour compatibilité, non utilisé directement # ── Base de données (pour pg_dump) ────────────────────── DB_HOST: str = "" DB_NAME: str = "postgres" DB_USER: str = "postgres" DB_PASSWORD: str = "" DB_PORT: int = 5432 BACKUP_DIR: str = "backups" # ── Storage ────────────────────────────────────────────── STORAGE_BUCKET: str = "dedalys-fichiers" STORAGE_SIGNED_URL_EXPIRY: int = 900 # 15 minutes par défaut # ── Email (Resend) ─────────────────────────────────────── # MVP — à configurer avant activation des rappels RESEND_API_KEY: str = "" EMAIL_FROM: str = "noreply@dedalys.ci" # ── Application ────────────────────────────────────────── APP_ENV: str = "development" # development | staging | production ALLOWED_ORIGINS: str = "http://localhost:3000" FRONTEND_URL: str = "http://localhost:3000" SUPABASE_RESET_PASSWORD_REDIRECT_URL: str = "http://localhost:3000/reset-password" class Config: env_file = ".env" env_file_encoding = "utf-8" extra = "ignore" @property def is_production(self) -> bool: return self.APP_ENV == "production" @property def is_development(self) -> bool: return self.APP_ENV == "development" @property def cors_origins(self) -> List[str]: """Parse ALLOWED_ORIGINS en liste.""" return [origin.strip() for origin in self.ALLOWED_ORIGINS.split(",") if origin.strip()] settings = Settings()