mirror of
http://88.130.71.182:3000/BlitTech/deals24togo_be.git
synced 2026-06-12 23:33:21 +00:00
Initial commit
This commit is contained in:
71
app/core/config.py
Normal file
71
app/core/config.py
Normal file
@@ -0,0 +1,71 @@
|
||||
"""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]
|
||||
Reference in New Issue
Block a user