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:
13
api.py
13
api.py
@@ -103,10 +103,17 @@ def root():
|
||||
}
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
@app.api_route("/health", methods=["GET", "HEAD"])
|
||||
def health():
|
||||
"""Health check — sem autenticação."""
|
||||
return {"status": "ok", "version": API_VERSION, "auth": is_auth_enabled()}
|
||||
"""Health check — sem autenticação. Suporta GET e HEAD (Docker Swarm)."""
|
||||
from fastapi.responses import JSONResponse
|
||||
return JSONResponse(
|
||||
content={"status": "ok"},
|
||||
headers={
|
||||
"X-Api-Status": "ok",
|
||||
"X-Api-Version": API_VERSION,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
# ── Endpoints Protegidos ────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user