From e4ab15149e86fe0547302b59f3ba89819209e87c Mon Sep 17 00:00:00 2001 From: eric Date: Sun, 23 Aug 2026 08:31:09 -0500 Subject: [PATCH] fix: include S3 status in /api/health for settings panel Co-authored-by: Cursor --- backend/app/main.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/backend/app/main.py b/backend/app/main.py index b4f76b7..e390b69 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -282,6 +282,26 @@ async def health() -> dict[str, Any]: except Exception as exc: return {"ok": False, "error": str(exc)[:120]} + def _s3() -> dict[str, Any]: + from . import s3_storage + + enabled = s3_storage.s3_enabled() + info: dict[str, Any] = { + "enabled": enabled, + "ok": False, + "endpoint": settings.s3_endpoint, + "bucket": settings.s3_bucket, + "public_base": settings.s3_public_base, + } + if not enabled: + return info + try: + s3_storage._client().head_bucket(Bucket=settings.s3_bucket) # noqa: SLF001 + info["ok"] = True + except Exception as exc: + info["error"] = str(exc)[:120] + return info + try: pb, yt = await asyncio.wait_for(asyncio.gather(_pb(), _yt()), timeout=1.2) out["pocketbase"] = pb @@ -289,6 +309,10 @@ async def health() -> dict[str, Any]: except Exception as exc: out["pocketbase"] = {"ok": False, "error": "timeout"} out["youtube"] = {"ok": False, "error": str(exc)[:80]} + try: + out["s3"] = await asyncio.wait_for(asyncio.to_thread(_s3), timeout=1.0) + except Exception as exc: + out["s3"] = {"enabled": False, "ok": False, "error": str(exc)[:120]} return out