From 880ae1f455f17fd5a3eafa30134fc61d8e641758 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 14 Sep 2024 21:12:43 +0000 Subject: [PATCH] error out when no recipients are specified --- prometheus_xmpp/__main__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/prometheus_xmpp/__main__.py b/prometheus_xmpp/__main__.py index fe20fb0..a4ecf70 100755 --- a/prometheus_xmpp/__main__.py +++ b/prometheus_xmpp/__main__.py @@ -208,6 +208,12 @@ async def serve_test(request): recipients = [request.match_info['to_jid']] except KeyError: recipients = request.app['recipients'] + if not recipients: + return web.Response( + status=500, + text="No recipients configured. Set `recipients` in configuration, `XMPP_RECIPIENTS` in environment or use /test/TO_JID.", + ) + test_counter.inc() try: text, html = await render_alert(