diff --git a/app/api/routes/routes.py b/app/api/routes/routes.py index 364cf74..38b1052 100644 --- a/app/api/routes/routes.py +++ b/app/api/routes/routes.py @@ -23,6 +23,7 @@ from flask_jwt_extended import ( from sqlalchemy import text from app.extensions import db from app.config import settings +from urllib.parse import urlparse api = Blueprint("api", __name__) @@ -128,6 +129,14 @@ def health_check(): errors = [] status = "ok" + # Extract the database URI + try: + db_uri = db.engine.url.render_as_string(hide_password=False) + db_uri = db_uri + except Exception as e: + db_uri = "Unavailable" + + # Check database connection try: db.session.execute(text("SELECT 1")) @@ -156,6 +165,7 @@ def health_check(): response = { "status": status, "db_status": db_status, + "db_uri": db_uri, "events_service_status": events_service_status, "errors": errors or None }