feat: Webhooks (Aufgaben 6-10) — webhook.py, worker.py, Flask-App, WhatsApp + Telegram Routes + Tests
This commit is contained in:
+33
@@ -0,0 +1,33 @@
|
||||
"""Flask App-Factory – Einstiegspunkt des BSN-Livesystems."""
|
||||
|
||||
from flask import Flask, jsonify
|
||||
|
||||
from src.queue.handler import QueueHandler
|
||||
|
||||
|
||||
def create_app() -> Flask:
|
||||
"""Erstellt und konfiguriert die Flask-App.
|
||||
|
||||
Nutzt das App-Factory-Pattern für saubere Initialisierung.
|
||||
Der QueueHandler wird als App-Extension hinterlegt.
|
||||
|
||||
Returns:
|
||||
Die konfigurierte Flask-App-Instanz.
|
||||
"""
|
||||
app = Flask(__name__)
|
||||
app.config.from_mapping(
|
||||
REDIS_HOST="localhost",
|
||||
REDIS_PORT=6379,
|
||||
)
|
||||
|
||||
app.queue_handler = QueueHandler(
|
||||
redis_host=app.config["REDIS_HOST"],
|
||||
redis_port=app.config["REDIS_PORT"],
|
||||
)
|
||||
|
||||
@app.route("/health")
|
||||
def health() -> dict:
|
||||
"""Health-Check Endpoint für Monitoring."""
|
||||
return {"status": "ok", "queue_size": app.queue_handler.queue_size()}
|
||||
|
||||
return app
|
||||
Reference in New Issue
Block a user