from pathlib import Path from typing import List from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): PROJECT_NAME: str = "Simple Todo Application" # CORS Configuration CORS_ORIGINS: List[str] = ["*"] CORS_ALLOW_CREDENTIALS: bool = True CORS_ALLOW_METHODS: List[str] = ["*"] CORS_ALLOW_HEADERS: List[str] = ["*"] # API Settings API_V1_STR: str = "" # Database Configuration DB_DIR: Path = Path("/app") / "storage" / "db" model_config = SettingsConfigDict( env_file=".env", env_file_encoding="utf-8", case_sensitive=True, ) def __init__(self, **kwargs): super().__init__(**kwargs) # Ensure DB directory exists self.DB_DIR.mkdir(parents=True, exist_ok=True) settings = Settings()