Spaces:
Runtime error
Runtime error
File size: 2,382 Bytes
c605dd5 430f98c c605dd5 430f98c c605dd5 d628201 c605dd5 430f98c c605dd5 430f98c c605dd5 430f98c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | """
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()
|