fix(api): 加 /health 存活探针端点(治Docker HEALTHCHECK恒unhealthy,/health原404)
CI/CD / test (push) Successful in 8s
CI/CD / nas-deploy (push) Successful in 21s
CI/CD / nas-verify (push) Successful in 3s

This commit is contained in:
2026-08-01 21:01:35 +08:00
parent f9b7c103c0
commit a17f291850
+6
View File
@@ -61,6 +61,12 @@ def build_app(config_path: str = "config/backtest.yaml", static_dir: str | None
max_workers=max_workers,
)
# Liveness probe for Docker HEALTHCHECK (curl -f /health). Registered
# unconditionally so it works with or without the SPA static mount.
@app.get("/health", include_in_schema=False)
async def _health() -> dict[str, str]:
return {"status": "ok"}
# SPA static mount with history fallback. Register the root route BEFORE
# mounting StaticFiles at "/" so the explicit handler wins for "/".
if static_dir and os.path.isdir(static_dir):