43 lines
1.1 KiB
Python

from pathlib import Path
from typing import List
from pydantic import AnyHttpUrl, EmailStr
from pydantic_settings import BaseSettings
# Get project base directory
BASE_DIR = Path(__file__).resolve().parent.parent.parent
class Settings(BaseSettings):
API_V1_STR: str = "/api/v1"
PROJECT_NAME: str = "User Authentication Service"
# SECURITY
SECRET_KEY: str = "YOUR_SECRET_KEY_CHANGE_THIS" # Change in production
ACCESS_TOKEN_EXPIRE_MINUTES: int = 30 # 30 minutes
ALGORITHM: str = "HS256"
# CORS
BACKEND_CORS_ORIGINS: List[AnyHttpUrl] = []
# Database
DB_DIR = Path("/app") / "storage" / "db"
SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
# Email
EMAILS_ENABLED: bool = False
EMAILS_FROM_NAME: str = "User Authentication Service"
EMAILS_FROM_EMAIL: EmailStr = "info@example.com"
SMTP_HOST: str = ""
SMTP_PORT: int = 587
SMTP_USER: str = ""
SMTP_PASSWORD: str = ""
class Config:
case_sensitive = True
env_file = BASE_DIR / ".env"
env_file_encoding = "utf-8"
settings = Settings()