Config-driven DATABASE_URL shared by the app and Alembic's env.py (fixes v1's config drift), psycopg3 driver, auto-discovering app/models package for SQLModel.metadata, and a /health endpoint that exercises the DB dependency end-to-end. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
19 lines
384 B
Python
19 lines
384 B
Python
from functools import lru_cache
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
database_url: str
|
|
environment: str = "development"
|
|
|
|
model_config = SettingsConfigDict(
|
|
env_file=".env",
|
|
env_file_encoding="utf-8",
|
|
extra="ignore",
|
|
)
|
|
|
|
|
|
@lru_cache
|
|
def get_settings() -> Settings:
|
|
return Settings()
|