feat: add Quart app factory, config loader, and /api/health endpoint
Config reads from env vars (12-factor); .env.example documents defaults. Health endpoint is liveness-only (no DB/Redis touch). Test added for CI. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
"""Singleton extension instances; bound to the app in create_app()."""
|
||||
|
||||
from sqlalchemy.ext.asyncio import AsyncEngine, async_sessionmaker, create_async_engine
|
||||
|
||||
from .config import get_config
|
||||
|
||||
|
||||
def make_engine() -> AsyncEngine:
|
||||
cfg = get_config()
|
||||
return create_async_engine(cfg.database_url, pool_pre_ping=True, future=True)
|
||||
|
||||
|
||||
def make_session_factory(engine: AsyncEngine) -> async_sessionmaker:
|
||||
return async_sessionmaker(engine, expire_on_commit=False)
|
||||
Reference in New Issue
Block a user