From 02a7d86106daf8612eef31b14fb9b0179731bc14 Mon Sep 17 00:00:00 2001 From: DecFox <33030671+DecFox@users.noreply.github.com> Date: Sat, 10 Aug 2024 19:57:25 +0530 Subject: [PATCH] fix: enable health endpoint (#870) --- .../oonifindings/src/oonifindings/main.py | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/ooniapi/services/oonifindings/src/oonifindings/main.py b/ooniapi/services/oonifindings/src/oonifindings/main.py index ef3da70c..d33602ef 100644 --- a/ooniapi/services/oonifindings/src/oonifindings/main.py +++ b/ooniapi/services/oonifindings/src/oonifindings/main.py @@ -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"