Files
pdf/gateway/app/routers/health.py
T

36 lines
921 B
Python

"""Liveness / readiness probes.
`/health` must work with **zero** engine dependencies — it is the signal load
balancers and orchestrators use to decide whether the process is up. It
deliberately does not import or touch the pybind11 bridge.
"""
from typing import Annotated
from fastapi import APIRouter, Depends
from pydantic import BaseModel
from app import __version__
from app.config import Settings, get_settings
router = APIRouter(tags=["health"])
SettingsDep = Annotated[Settings, Depends(get_settings)]
class HealthResponse(BaseModel):
status: str
version: str
environment: str
engine_available: bool
@router.get("/health", response_model=HealthResponse)
def health(settings: SettingsDep) -> HealthResponse:
return HealthResponse(
status="ok",
version=__version__,
environment=settings.environment,
engine_available=settings.engine_available,
)