mirror of
https://github.com/Balshgit/mosgortrans.git
synced 2025-09-11 13:00:40 +03:00
add health check
This commit is contained in:
parent
b829c640fd
commit
0e4e0e17c2
@ -75,6 +75,10 @@ async def put_updates_on_queue(request: web.Request) -> web.Response:
|
|||||||
return web.Response(status=HTTPStatus.ACCEPTED)
|
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:
|
async def get_updates_from_queue() -> None:
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
@ -85,6 +89,7 @@ async def get_updates_from_queue() -> None:
|
|||||||
|
|
||||||
async def create_app() -> web.Application:
|
async def create_app() -> web.Application:
|
||||||
application = web.Application()
|
application = web.Application()
|
||||||
|
application.router.add_get('/', health_check)
|
||||||
application.router.add_post(
|
application.router.add_post(
|
||||||
f'{WEBHOOK_PATH}/{TELEGRAM_API_TOKEN}', put_updates_on_queue
|
f'{WEBHOOK_PATH}/{TELEGRAM_API_TOKEN}', put_updates_on_queue
|
||||||
)
|
)
|
||||||
|
@ -16,7 +16,7 @@ config = AutoConfig(search_path=env_path)
|
|||||||
GECKO_DRIVER_VERSION = config('GECKO_DRIVER_VERSION', default='0.31.0')
|
GECKO_DRIVER_VERSION = config('GECKO_DRIVER_VERSION', default='0.31.0')
|
||||||
|
|
||||||
TELEGRAM_API_TOKEN = config(
|
TELEGRAM_API_TOKEN = config(
|
||||||
'API_TOKEN', default='123456789:AABBCCDDEEFFaabbccddeeff-1234567890'
|
'TELEGRAM_API_TOKEN', default='123456789:AABBCCDDEEFFaabbccddeeff-1234567890'
|
||||||
)
|
)
|
||||||
|
|
||||||
# webhook settings
|
# webhook settings
|
||||||
|
Loading…
x
Reference in New Issue
Block a user