Automated Action 908da9e9de Fix database migration error
- Added missing pydantic-settings to requirements.txt
- Fixed database path inconsistency between config.py and session.py
- Updated alembic.ini to use proper SQLite URL format
- Updated migrations/env.py to use config settings

🤖 Generated with BackendIM... (backend.im)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-12 17:05:16 +00:00

44 lines
1.4 KiB
Python

import secrets
from typing import Any, Dict, List, Optional, Union
from pydantic import AnyHttpUrl, EmailStr, HttpUrl, validator
from pydantic_settings import BaseSettings
class Settings(BaseSettings):
PROJECT_NAME: str = "User Authentication Flow Service"
DESCRIPTION: str = "A service for user authentication flow"
VERSION: str = "0.1.0"
API_V1_STR: str = "/api/v1"
# Secret key for JWT
SECRET_KEY: str = secrets.token_urlsafe(32)
# 60 minutes * 24 hours * 8 days = 8 days
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 8
# CORS settings
BACKEND_CORS_ORIGINS: List[AnyHttpUrl] = []
@validator("BACKEND_CORS_ORIGINS", pre=True)
def assemble_cors_origins(cls, v: Union[str, List[str]]) -> Union[List[str], str]:
if isinstance(v, str) and not v.startswith("["):
return [i.strip() for i in v.split(",")]
elif isinstance(v, (list, str)):
return v
raise ValueError(v)
# Debug mode
DEBUG: bool = True
# Database settings
DB_PATH: str = "/projects/userauthenticationflowservice-fvu111/storage/db/db.sqlite"
SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_PATH}"
# First superuser
FIRST_SUPERUSER: EmailStr = "admin@example.com"
FIRST_SUPERUSER_PASSWORD: str = "admin"
class Config:
case_sensitive = True
settings = Settings()