25 lines
823 B
Python
25 lines
823 B
Python
import os
|
|
from pathlib import Path
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
class Settings(BaseSettings):
|
|
PROJECT_NAME: str = "Task Manager API"
|
|
PROJECT_DESCRIPTION: str = "A FastAPI-based Task Manager API"
|
|
VERSION: str = "0.1.0"
|
|
|
|
# Database
|
|
DB_DIR: Path = Path("/app") / "storage" / "db"
|
|
DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
|
|
|
|
# Security
|
|
SECRET_KEY: str = os.getenv("SECRET_KEY", "supersecretkey")
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = int(os.getenv("ACCESS_TOKEN_EXPIRE_MINUTES", "60"))
|
|
ALGORITHM: str = "HS256"
|
|
|
|
model_config = SettingsConfigDict(env_file=".env", case_sensitive=True)
|
|
|
|
# Create an instance of the Settings class
|
|
settings = Settings()
|
|
|
|
# Ensure DB directory exists
|
|
settings.DB_DIR.mkdir(parents=True, exist_ok=True) |