from pathlib import Path from typing import List from pydantic_settings import BaseSettings class Settings(BaseSettings): # API Configuration API_V1_STR: str = "/api/v1" PROJECT_NAME: str = "Todo API" PROJECT_DESCRIPTION: str = "A simple TODO application API" PROJECT_VERSION: str = "0.1.0" # CORS Configuration CORS_ORIGINS: List[str] = ["*"] # Database Configuration DB_DIR: Path = Path("/app/storage/db") SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite" class Config: env_file = ".env" env_file_encoding = "utf-8" case_sensitive = True settings = Settings() # Create DB directory if it doesn't exist settings.DB_DIR.mkdir(parents=True, exist_ok=True)