from pathlib import Path from pydantic_settings import BaseSettings class Settings(BaseSettings): # Project settings PROJECT_NAME: str = "Generic REST API" PROJECT_DESCRIPTION: str = "A generic REST API built with FastAPI and SQLite" PROJECT_VERSION: str = "0.1.0" # Database settings DB_DIR: Path = Path("/app") / "storage" / "db" SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite" class Config: env_file = ".env" case_sensitive = True # Create settings instance settings = Settings() # Ensure DB directory exists settings.DB_DIR.mkdir(parents=True, exist_ok=True)