22 lines
676 B
Python

import os
from pydantic_settings import BaseSettings
from pathlib import Path
class Settings(BaseSettings):
API_V1_STR: str = "/api/v1"
PROJECT_NAME: str = "GenericRestAPI"
PROJECT_DESCRIPTION: str = "A FastAPI-based REST API"
VERSION: str = "0.1.0"
# Database settings
# Use environment variable for database path or fall back to a directory
# relative to the current working directory for better compatibility
DB_DIR: Path = Path(os.environ.get("DB_DIR", os.path.join(os.getcwd(), "storage", "db")))
SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
class Config:
case_sensitive = True
settings = Settings()