add health check

This commit is contained in:
Dmitry Afanasyev 2022-08-26 00:09:54 +03:00
parent b829c640fd
commit 0e4e0e17c2
2 changed files with 6 additions and 1 deletions

View File

@ -75,6 +75,10 @@ async def put_updates_on_queue(request: web.Request) -> web.Response:
return web.Response(status=HTTPStatus.ACCEPTED)
async def health_check(request: web.Request) -> web.Response:
return web.Response(text='Health OK', status=HTTPStatus.OK)
async def get_updates_from_queue() -> None:
while True:
@ -85,6 +89,7 @@ async def get_updates_from_queue() -> None:
async def create_app() -> web.Application:
application = web.Application()
application.router.add_get('/', health_check)
application.router.add_post(
f'{WEBHOOK_PATH}/{TELEGRAM_API_TOKEN}', put_updates_on_queue
)

View File

@ -16,7 +16,7 @@ config = AutoConfig(search_path=env_path)
GECKO_DRIVER_VERSION = config('GECKO_DRIVER_VERSION', default='0.31.0')
TELEGRAM_API_TOKEN = config(
'API_TOKEN', default='123456789:AABBCCDDEEFFaabbccddeeff-1234567890'
'TELEGRAM_API_TOKEN', default='123456789:AABBCCDDEEFFaabbccddeeff-1234567890'
)
# webhook settings