Skip to content

Commit

Permalink
fix: enable health endpoint (#870)
Browse files Browse the repository at this point in the history
  • Loading branch information
DecFox authored Aug 10, 2024
1 parent f8f12ef commit 02a7d86
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions ooniapi/services/oonifindings/src/oonifindings/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,24 +70,24 @@ async def health(
):
errors = []

#try:
# db.query(models.OONIFinding).limit(1).all()
#except Exception as exc:
# log.error(exc)
# errors.append("db_error")

#if settings.jwt_encryption_key == "CHANGEME":
# err = "bad_jwt_secret"
# log.error(err)
# errors.append(err)

#if settings.prometheus_metrics_password == "CHANGEME":
# err = "bad_prometheus_password"
# log.error(err)
# errors.append(err)

#if len(errors) > 0:
# raise HTTPException(status_code=400, detail="health check failed")
try:
db.query(models.OONIFinding).limit(1).all()
except Exception as exc:
log.error(exc)
errors.append("db_error")

if settings.jwt_encryption_key == "CHANGEME":
err = "bad_jwt_secret"
log.error(err)
errors.append(err)

if settings.prometheus_metrics_password == "CHANGEME":
err = "bad_prometheus_password"
log.error(err)
errors.append(err)

if len(errors) > 0:
raise HTTPException(status_code=400, detail="health check failed")

status = "ok"

Expand Down

0 comments on commit 02a7d86

Please sign in to comment.