Compare commits

2 Commits

Author SHA1 Message Date
sheppy 55cc4cfeef fix: add missing imports
ci / docker (push) Successful in 51s
2026-05-06 22:50:00 +02:00
sheppy b9a5e7f32f feat: check db connection on health endpoint 2026-05-06 22:02:26 +02:00
+8 -3
View File
@@ -12,12 +12,13 @@ import yaml
import ldaptools
import messagetools
from sqlalchemy import Column, Integer, String, Boolean, or_, and_
from sqlalchemy import Column, Integer, String, Boolean, or_, and_, text
from sqlalchemy.orm import sessionmaker
from sqlalchemy.exc import IntegrityError
from sqlalchemy.exc import IntegrityError, SQLAlchemyError
from sqlalchemy.sql import func
import sqlalchemy
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.sql.expression import func
OPENSEARCH_HEADER_SEPERATOR = ","
@@ -429,7 +430,11 @@ def save_in_dispatch_queue(persons, title, message, method, link=""):
@app.route("/health")
def health():
return ("Not Iplemented, but at least it's running", 200)
try:
db.session.execute(text("SELECT 1"))
return ({"status": "ok"}, 200)
except Exception as e:
return ({"status": "error", "message": str(e)}, 500)
def create_app():