aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Smith <[email protected]>2024-10-14 10:13:17 +0200
committerDaniel Smith <[email protected]>2025-02-24 10:33:08 +0000
commit0a43fdf4cf2c65374cd097c9ab729aa607a26d27 (patch)
treede22248a9854752e04ea0754e868c08dd76a2b5c
parentf7c6fc29ca6484712086fecb3dc54dddea86f017 (diff)
Add status check endpoint for monitoringHEADdev
Also requires updating the interface binding to 0.0.0.0 to accept non-localhost requests. Change-Id: I029eb8e0d249e7f170f91fbc9b2764b2b1c76ab6 Reviewed-by: Daniel Smith <[email protected]>
-rw-r--r--main.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/main.py b/main.py
index 0f71243..003d92c 100644
--- a/main.py
+++ b/main.py
@@ -327,15 +327,19 @@ async def handle(request):
return web.Response(status=200)
+async def getStatus(request):
+ return web.Response(text='OK')
+
async def run_web_server():
""" Run the web server. """
app = web.Application()
+ app.add_routes([web.get('/status', getStatus)])
app.add_routes([web.post('/', handle)])
runner = web.AppRunner(app)
await runner.setup()
port = os.environ.get("PORT") or 8088
- site = web.TCPSite(runner, 'localhost', port)
+ site = web.TCPSite(runner, '0.0.0.0', port)
await site.start()
log.info("Web server started on port %s", port)