Sdm0 commited on
Commit
bd15e0c
·
verified ·
1 Parent(s): 8e617b8

feat: expose deployment readiness health details

Browse files
Files changed (1) hide show
  1. api.py +13 -2
api.py CHANGED
@@ -173,8 +173,19 @@ _hydrate_jobs()
173
 
174
 
175
  @app.get("/api/health")
176
- def health() -> dict[str, str]:
177
- return {"status": "ok"}
 
 
 
 
 
 
 
 
 
 
 
178
 
179
 
180
  @app.post("/api/reviews", status_code=202)
 
173
 
174
 
175
  @app.get("/api/health")
176
+ def health() -> dict[str, Any]:
177
+ provider_configured = any(
178
+ os.getenv(name, "").strip()
179
+ for name in ("GEMINI_API_KEY", "GROQ_API_KEY", "OPENAI_API_KEY", "ANTHROPIC_API_KEY")
180
+ )
181
+ require_auth = os.getenv("OCR_REQUIRE_AUTH", "false").strip().lower() in {"1", "true", "yes", "on"}
182
+ return {
183
+ "status": "ok",
184
+ "inference": "remote_provider_configured" if provider_configured else "fallback_or_unconfigured",
185
+ "authentication": "required" if require_auth else "optional",
186
+ "persistence": "configured_path" if os.getenv("OPENCODEREVIEW_DB_PATH") else "local_default_path",
187
+ "local_embeddings": False,
188
+ }
189
 
190
 
191
  @app.post("/api/reviews", status_code=202)