33 lines
953 B
Python
33 lines
953 B
Python
import os
|
|
from pathlib import Path
|
|
from typing import List
|
|
from pydantic_settings import BaseSettings
|
|
|
|
class Settings(BaseSettings):
|
|
# API Settings
|
|
PROJECT_NAME: str = "Insurance System API"
|
|
PROJECT_DESCRIPTION: str = "API for managing insurance policies, customers, and claims"
|
|
PROJECT_VERSION: str = "0.1.0"
|
|
API_V1_STR: str = "/api/v1"
|
|
|
|
# Database Settings
|
|
DB_DIR: Path = Path("/app") / "storage" / "db"
|
|
SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
|
|
|
|
# Security Settings
|
|
SECRET_KEY: str = os.getenv("SECRET_KEY", "supersecretkey")
|
|
ALGORITHM: str = "HS256"
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
|
|
|
|
# CORS Settings
|
|
BACKEND_CORS_ORIGINS: List[str] = ["*"]
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
case_sensitive = True
|
|
|
|
# Create settings instance
|
|
settings = Settings()
|
|
|
|
# Ensure database directory exists
|
|
settings.DB_DIR.mkdir(parents=True, exist_ok=True) |