feat: add is_chat field to board memory and task_id to approvals, update pagination and response models
This commit is contained in:
@@ -1,11 +1,20 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
from typing import Self
|
||||
|
||||
from pydantic import model_validator
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
BACKEND_ROOT = Path(__file__).resolve().parents[2]
|
||||
DEFAULT_ENV_FILE = BACKEND_ROOT / ".env"
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
model_config = SettingsConfigDict(
|
||||
env_file=".env",
|
||||
# Load `backend/.env` regardless of current working directory.
|
||||
# (Important when running uvicorn from repo root or via a process manager.)
|
||||
env_file=[DEFAULT_ENV_FILE, ".env"],
|
||||
env_file_encoding="utf-8",
|
||||
extra="ignore",
|
||||
)
|
||||
@@ -30,5 +39,13 @@ class Settings(BaseSettings):
|
||||
log_format: str = "text"
|
||||
log_use_utc: bool = False
|
||||
|
||||
@model_validator(mode="after")
|
||||
def _defaults(self) -> Self:
|
||||
# In dev, default to applying Alembic migrations at startup to avoid schema drift
|
||||
# (e.g. missing newly-added columns).
|
||||
if "db_auto_migrate" not in self.model_fields_set and self.environment == "dev":
|
||||
self.db_auto_migrate = True
|
||||
return self
|
||||
|
||||
|
||||
settings = Settings()
|
||||
|
||||
Reference in New Issue
Block a user