diff --git a/ProxyAPI/app/api/miscellaneous_endpints.py b/ProxyAPI/app/api/miscellaneous_endpints.py index 2cda37b9a7620a3967196731a97b5646d76460e3..27afde86a4f3294a2b1749c6106e6ad727fc5731 100644 --- a/ProxyAPI/app/api/miscellaneous_endpints.py +++ b/ProxyAPI/app/api/miscellaneous_endpints.py @@ -1,21 +1,22 @@ +import httpx from fastapi import APIRouter, Depends, HTTPException, status -from rgwadmin import RGWAdmin from sqlalchemy.ext.asyncio import AsyncSession from starlette.responses import RedirectResponse -from app.api.dependencies import get_db, get_rgw_admin +from app.api.dependencies import get_db +from app.core.config import settings miscellaneous_router = APIRouter() @miscellaneous_router.get("/health", include_in_schema=False) -async def health_check(db: AsyncSession = Depends(get_db), rgw: RGWAdmin = Depends(get_rgw_admin)) -> dict[str, str]: +async def health_check(db: AsyncSession = Depends(get_db)) -> dict[str, str]: try: assert db.is_active except Exception: raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail="Connection to database lost") try: - rgw.get_users() + httpx.get(settings.OBJECT_GATEWAY_URI, timeout=5.0) except Exception: raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail="Connection to RGW lost") return {"status": "OK"}