feat: Flask-App-Factory mit Health-Check und QueueHandler

This commit is contained in:
Hermes Agent
2026-06-22 06:34:09 +02:00
parent c2b3ee551f
commit 3e360911f5
4 changed files with 88 additions and 0 deletions
View File
+22
View File
@@ -0,0 +1,22 @@
from flask import Flask
from src.queue.handler import QueueHandler
def create_app() -> Flask:
"""Erstellt und konfiguriert die Flask-App."""
app = Flask(__name__)
app.config.from_mapping(
REDIS_HOST="localhost",
REDIS_PORT=6379,
)
app.queue_handler = QueueHandler( # type: ignore[attr-defined]
redis_host=app.config["REDIS_HOST"],
redis_port=app.config["REDIS_PORT"],
)
@app.route("/health")
def health() -> dict[str, object]:
return {"status": "ok", "queue_size": app.queue_handler.queue_size()} # type: ignore[attr-defined]
return app