2026-06-09 23:29:24 +00:00
|
|
|
import os
|
2026-06-10 21:35:12 +00:00
|
|
|
from functools import lru_cache
|
|
|
|
|
|
|
|
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
|
|
|
# Application
|
|
|
|
|
APP_NAME: str = "FreeTable"
|
|
|
|
|
APP_VERSION: str = "1.0.0"
|
|
|
|
|
DEBUG: bool = os.getenv("DEBUG", "false").lower() == "true"
|
|
|
|
|
|
2026-06-09 23:29:24 +00:00
|
|
|
# Database
|
|
|
|
|
DATABASE_URL: str = os.getenv("DATABASE_URL", "sqlite:///./freetable.db")
|
2026-06-10 21:35:12 +00:00
|
|
|
|
|
|
|
|
# JWT
|
|
|
|
|
SECRET_KEY: str = os.getenv("SECRET_KEY", "change-me-in-production")
|
2026-06-09 23:29:24 +00:00
|
|
|
ALGORITHM: str = "HS256"
|
2026-06-10 21:35:12 +00:00
|
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = 1440 # 24 hours
|
|
|
|
|
|
2026-06-09 23:29:24 +00:00
|
|
|
# CORS
|
2026-06-10 21:35:12 +00:00
|
|
|
CORS_ORIGINS: list[str] = ["http://localhost:5173", "http://localhost:3000"]
|
|
|
|
|
|
|
|
|
|
# Password
|
|
|
|
|
PASSWORD_COST_FACTOR: int = 12
|
|
|
|
|
|
|
|
|
|
# Upload
|
|
|
|
|
UPLOAD_DIR: str = os.getenv("UPLOAD_DIR", "./uploads")
|
|
|
|
|
MAX_UPLOAD_SIZE: int = 10 * 1024 * 1024 # 10MB
|
|
|
|
|
|
|
|
|
|
class Config:
|
|
|
|
|
env_file = ".env"
|
|
|
|
|
case_sensitive = True
|
|
|
|
|
|
2026-06-09 23:29:24 +00:00
|
|
|
|
2026-06-10 21:35:12 +00:00
|
|
|
@lru_cache()
|
|
|
|
|
def get_settings() -> Settings:
|
|
|
|
|
return Settings()
|