"""Application configuration loaded from environment variables.""" from __future__ import annotations from functools import lru_cache from typing import List from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): model_config = SettingsConfigDict( env_file=".env", env_file_encoding="utf-8", case_sensitive=False, extra="ignore", ) # ── App ─────────────────────────────────────────────── APP_NAME: str = "Deals24Togo" APP_ENV: str = "development" DEBUG: bool = False ALLOWED_ORIGINS: str = "http://localhost:5173,http://localhost:3000" @property def allowed_origins_list(self) -> List[str]: return [o.strip() for o in self.ALLOWED_ORIGINS.split(",") if o.strip()] # ── Supabase ────────────────────────────────────────── SUPABASE_URL: str SUPABASE_KEY: str SUPABASE_SERVICE_ROLE_KEY: str # ── Auth / JWT ──────────────────────────────────────── SUPABASE_JWT_SECRET: str = "change-me" # ── Storage ─────────────────────────────────────────── SUPABASE_STORAGE_BUCKET: str = "listings" MAX_UPLOAD_SIZE_MB: int = 10 @property def max_upload_size_bytes(self) -> int: return self.MAX_UPLOAD_SIZE_MB * 1024 * 1024 # ── Rate limiting ───────────────────────────────────── RATE_LIMIT_PER_MINUTE: int = 60 # ── Sentry ──────────────────────────────────────────── SENTRY_DSN: str = "" # ── Email ───────────────────────────────────────────── SMTP_HOST: str = "" SMTP_PORT: int = 587 SMTP_USER: str = "" SMTP_PASSWORD: str = "" EMAIL_FROM: str = "noreply@deals24togo.com" # ── Frontend ────────────────────────────────────────── FRONTEND_URL: str = "http://localhost:5173" # ── CinetPay ────────────────────────────────────────── CINETPAY_API_KEY: str = "" CINETPAY_SITE_ID: str = "" BACKEND_PUBLIC_URL: str = "http://localhost:8000" SUBSCRIPTION_MONTHLY_AMOUNT: int = 1000 SUBSCRIPTION_YEARLY_AMOUNT: int = 10000 @lru_cache def get_settings() -> Settings: return Settings() # type: ignore[call-arg]