import os from pathlib import Path from pydantic import BaseSettings, validator class Settings(BaseSettings): # Base settings API_V1_STR: str = "/api/v1" PROJECT_NAME: str = "Bible Quiz App API" PROJECT_DESCRIPTION: str = "API for a Bible Quiz application with questions, quizzes, and user management" VERSION: str = "0.1.0" # Security settings SECRET_KEY: str = os.getenv("SECRET_KEY", "change_this_secret_key_in_production") ACCESS_TOKEN_EXPIRE_MINUTES: int = int(os.getenv("ACCESS_TOKEN_EXPIRE_MINUTES", "60")) # Database settings DB_DIR: Path = Path("/app/storage/db") @validator("DB_DIR", pre=True) def create_db_dir(cls, v: Path) -> Path: v.mkdir(parents=True, exist_ok=True) return v SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite" class Config: env_file = ".env" case_sensitive = True settings = Settings()