fix: health check aceita HEAD (Docker Swarm)

O health check do Swarm usa HEAD, não GET. HEAD retornava 405 e o container era morto.
This commit is contained in:
CM Consultor
2026-08-09 05:14:35 +00:00
parent e97adca143
commit a65066fe08

13
api.py
View File

@@ -103,10 +103,17 @@ def root():
} }
@app.get("/health") @app.api_route("/health", methods=["GET", "HEAD"])
def health(): def health():
"""Health check — sem autenticação.""" """Health check — sem autenticação. Suporta GET e HEAD (Docker Swarm)."""
return {"status": "ok", "version": API_VERSION, "auth": is_auth_enabled()} from fastapi.responses import JSONResponse
return JSONResponse(
content={"status": "ok"},
headers={
"X-Api-Status": "ok",
"X-Api-Version": API_VERSION,
},
)
# ── Endpoints Protegidos ──────────────────────────────────────────── # ── Endpoints Protegidos ────────────────────────────────────────────