Commit dd601efc by Oleksandr Barabash

health-check handler added, port changed to 8000

parent d66bddc8
...@@ -151,6 +151,12 @@ async def v1_messages(request: Request) -> Response: ...@@ -151,6 +151,12 @@ async def v1_messages(request: Request) -> Response:
return Response(status=HTTPStatus.OK) return Response(status=HTTPStatus.OK)
async def v1_health_check(_request: Request) -> Response:
""" Health check """
# TODO(s1z): Add checks here. DB, etc.
return Response(status=HTTPStatus.OK)
@web.middleware @web.middleware
async def error_middleware(request, handler): async def error_middleware(request, handler):
""" Error handler """ """ Error handler """
...@@ -173,6 +179,7 @@ APP.router.add_post("/api/v1/notification", v1_notification) ...@@ -173,6 +179,7 @@ APP.router.add_post("/api/v1/notification", v1_notification)
APP.router.add_get("/api/v1/notification/{notification_id}", APP.router.add_get("/api/v1/notification/{notification_id}",
v1_get_notification) v1_get_notification)
APP.router.add_get("/api/v1/initiations/{notification_id}", v1_get_initiations) APP.router.add_get("/api/v1/initiations/{notification_id}", v1_get_initiations)
APP.router.add_get("/api/v1/health-check", v1_health_check)
BOT.add_web_app(APP) BOT.add_web_app(APP)
......
...@@ -23,7 +23,7 @@ class TaskModuleConfig: ...@@ -23,7 +23,7 @@ class TaskModuleConfig:
class AppConfig: class AppConfig:
""" Bot Configuration """ """ Bot Configuration """
PORT = 3978 PORT = os.environ.get("HOST_PORT", 8000)
APP_ID = os.environ.get("MS_APP_ID", APP_ID = os.environ.get("MS_APP_ID",
"d472f12a-323b-4058-b89b-7a4b15c48ab7") "d472f12a-323b-4058-b89b-7a4b15c48ab7")
APP_PASSWORD = os.environ.get("MS_APP_PASSWORD", APP_PASSWORD = os.environ.get("MS_APP_PASSWORD",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment