Spaces:
Runtime error
Runtime error
chrisaka
feat: Add automated daily database backups, subscription expiration reminders, and enhance user creation in espaces.
d628201 Download app/core/config.py from dedalys-civ/dedalys-api: direct link, hf CLI and curl.
- Browser
- Download file 2.38 kB
-
https://huggingface.co/spaces/dedalys-civ/dedalys-api/resolve/main/app/core/config.py
- Command line
-
hf download hf://spaces/dedalys-civ/dedalys-api/app/core/config.py
-
curl -L -o config.py https://huggingface.co/spaces/dedalys-civ/dedalys-api/resolve/main/app/core/config.py
2.38 kB
| """ | |
| 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" | |
| def is_production(self) -> bool: | |
| return self.APP_ENV == "production" | |
| def is_development(self) -> bool: | |
| return self.APP_ENV == "development" | |
| 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() | |