PYTHON
config.py🐍python
"""
Application configuration using Pydantic settings.
"""
from pydantic_settings import BaseSettings
from functools import lru_cache
class Settings(BaseSettings):
"""Application settings loaded from environment variables."""
# Database
DATABASE_URL: str = "sqlite:///./tasks.db"
# JWT Settings
SECRET_KEY: str = "your-secret-key-change-in-production"
ALGORITHM: str = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
# App Settings
APP_NAME: str = "Task Management API"
DEBUG: bool = True
class Config:
env_file = ".env"
@lru_cache
def get_settings() -> Settings:
"""Cache settings to avoid reading env file multiple times."""
return Settings()
settings = get_settings()