
- Removed unused imports in deps.py, routes/auth.py, and models/user.py - Code is now lint-free and follows best practices - Complete FastAPI user authentication service with JWT token support generated with BackendIM... (backend.im)
28 lines
755 B
Python
28 lines
755 B
Python
from pathlib import Path
|
|
from typing import List
|
|
|
|
from pydantic import AnyHttpUrl
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
API_V1_STR: str = "/api/v1"
|
|
PROJECT_NAME: str = "User Authentication Service"
|
|
|
|
# CORS
|
|
CORS_ORIGINS: List[AnyHttpUrl] = []
|
|
|
|
# JWT
|
|
SECRET_KEY: str = "supersecretkey" # In production, set this as an env variable
|
|
ALGORITHM: str = "HS256"
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
|
|
|
|
# Database
|
|
DB_DIR = Path("/app") / "storage" / "db"
|
|
DB_DIR.mkdir(parents=True, exist_ok=True)
|
|
SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
|
|
|
|
model_config = SettingsConfigDict(case_sensitive=True)
|
|
|
|
|
|
settings = Settings() |