add /health/db endpoint for supabase connection diagnostics
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4a0e043a6d
commit
35a61e11d5
1 changed files with 18 additions and 0 deletions
|
|
@ -165,6 +165,24 @@ def health():
|
|||
return {"status": "ok", "service": "signal-api", "version": "1.0.0"}
|
||||
|
||||
|
||||
@app.get("/health/db")
|
||||
def health_db():
|
||||
from core.supabase_client import get_client
|
||||
import os
|
||||
client = get_client()
|
||||
if not client:
|
||||
return {
|
||||
"status": "unavailable",
|
||||
"supabase_url_set": bool(os.getenv("SUPABASE_URL")),
|
||||
"service_key_set": bool(os.getenv("SUPABASE_SERVICE_KEY")),
|
||||
}
|
||||
try:
|
||||
result = client.table("organizations").select("id").limit(1).execute()
|
||||
return {"status": "ok", "org_count": len(result.data)}
|
||||
except Exception as e:
|
||||
return {"status": "error", "detail": str(e)}
|
||||
|
||||
|
||||
@app.post("/api/upload", response_model=UploadResponse)
|
||||
async def upload_csv(
|
||||
file: UploadFile = File(...),
|
||||
|
|
|
|||
Loading…
Reference in a new issue