37 lines
921 B
Python
37 lines
921 B
Python
"""
|
|
Application configuration from environment variables
|
|
"""
|
|
import os
|
|
from pathlib import Path
|
|
from typing import List
|
|
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""
|
|
Application settings from environment variables
|
|
"""
|
|
API_V1_STR: str = "/api/v1"
|
|
PROJECT_NAME: str = "Task Manager API"
|
|
|
|
# CORS settings
|
|
BACKEND_CORS_ORIGINS: List[str] = ["*"]
|
|
|
|
# Security settings
|
|
SECRET_KEY: str = os.getenv("SECRET_KEY", "changethisinproduction")
|
|
ALGORITHM: str = "HS256"
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
|
|
|
|
# Database settings
|
|
DB_DIR: Path = Path("/app") / "storage" / "db"
|
|
DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
|
|
|
|
class Config:
|
|
"""Pydantic config class"""
|
|
env_file = ".env"
|
|
env_file_encoding = "utf-8"
|
|
case_sensitive = True
|
|
|
|
# Create global settings object
|
|
settings = Settings() |