import os from pathlib import Path from pydantic_settings import BaseSettings class Settings(BaseSettings): # Project settings PROJECT_NAME: str = "Todo API" API_V1_STR: str = "/api/v1" DEBUG: bool = True # Server settings HOST: str = "0.0.0.0" PORT: int = 8000 # Database settings DB_DIR: Path = Path("/app") / "storage" / "db" DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite" class Config: env_file = ".env" env_file_encoding = "utf-8" settings = Settings() # Ensure DB directory exists settings.DB_DIR.mkdir(parents=True, exist_ok=True)