Update config.py to use pydantic-settings and proper DB path
generated with BackendIM... (backend.im)
This commit is contained in:
parent
d129d81b84
commit
5c35814207
@ -1,5 +1,5 @@
|
||||
from pathlib import Path
|
||||
from typing import List
|
||||
from typing import List, ClassVar
|
||||
|
||||
from pydantic import AnyHttpUrl
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
@ -8,20 +8,20 @@ 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: ClassVar[Path] = 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)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user