Spaces:
Sleeping
Sleeping
Commit ·
a1cb2e4
1
Parent(s): eb706ee
potential fix
Browse files
app.py
CHANGED
|
@@ -395,3 +395,20 @@ async def validate(payload):
|
|
| 395 |
except Exception:
|
| 396 |
logger.exception("Failed to process PR #%d", pr_num)
|
| 397 |
return {"status": "error", "reason": "processing failed"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 395 |
except Exception:
|
| 396 |
logger.exception("Failed to process PR #%d", pr_num)
|
| 397 |
return {"status": "error", "reason": "processing failed"}
|
| 398 |
+
|
| 399 |
+
|
| 400 |
+
# ---------------------------------------------------------------------------
|
| 401 |
+
# Server startup
|
| 402 |
+
# ---------------------------------------------------------------------------
|
| 403 |
+
|
| 404 |
+
if __name__ == "__main__":
|
| 405 |
+
app = WebhooksServer(
|
| 406 |
+
ui=None, # No UI, just webhook endpoint
|
| 407 |
+
webhook_secret=os.environ.get("WEBHOOKS_SECRET"),
|
| 408 |
+
)
|
| 409 |
+
app.add_webhook(validate)
|
| 410 |
+
|
| 411 |
+
# Start the server on port 7860 (HF Spaces default)
|
| 412 |
+
port = int(os.environ.get("PORT", 7860))
|
| 413 |
+
logger.info("Starting webhook server on port %d", port)
|
| 414 |
+
app.run(server_name="0.0.0.0", server_port=port)
|