24 lines
670 B
Python
24 lines
670 B
Python
"""Health endpoints."""
|
|
|
|
from fastapi import APIRouter, Depends
|
|
|
|
from core.config import Settings, get_settings
|
|
from features.health.schemas import HealthResponse
|
|
|
|
router = APIRouter(prefix="/health", tags=["health"])
|
|
|
|
|
|
def build_health_payload(settings: Settings) -> HealthResponse:
|
|
"""Build health response payload."""
|
|
return HealthResponse(
|
|
status="ok",
|
|
service=settings.service_name,
|
|
environment=settings.environment,
|
|
)
|
|
|
|
|
|
@router.get("/", response_model=HealthResponse)
|
|
def health(settings: Settings = Depends(get_settings)) -> HealthResponse:
|
|
"""Return lightweight health status."""
|
|
return build_health_payload(settings)
|