From 5a8a7a7638aa1de25cc2263ba26cdd7bbb61ac0c Mon Sep 17 00:00:00 2001 From: caetano melone Date: Mon, 4 Mar 2024 10:20:58 -0800 Subject: [PATCH] fix: remove custom GET length, 8K is sufficient for one url-encoded json spec --- docs/deploy.md | 3 --- gantry/__main__.py | 29 +++-------------------------- 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/docs/deploy.md b/docs/deploy.md index d326fc5..fd17d0b 100644 --- a/docs/deploy.md +++ b/docs/deploy.md @@ -28,6 +28,3 @@ The following variables should be exposed to the container. Those **bolded** are - **`GITLAB_API_TOKEN`** - this token should have API read access - **`GITLAB_WEBHOOK_TOKEN`** - coordinate this value with the collection webhook - **`DB_FILE`** - path where the application can access the SQLite file -- `MAX_GET_SIZE` - the maximum `GET` request (in bytes), default is 8MB -- `GANTRY_HOST` - web app hostname, default is `localhost` -- `GANTRY_PORT` - web app port, default is `8080` diff --git a/gantry/__main__.py b/gantry/__main__.py index 0a9854a..a420f94 100644 --- a/gantry/__main__.py +++ b/gantry/__main__.py @@ -1,4 +1,3 @@ -import asyncio import logging import os @@ -34,35 +33,13 @@ async def init_clients(app: web.Application): ) -async def main(): +def main(): app = web.Application() app.add_routes(routes) app.cleanup_ctx.append(init_db) app.on_startup.append(init_clients) - runner = web.AppRunner( - app, max_line_size=int(os.environ.get("MAX_GET_SIZE", 800_000)) - ) - await runner.setup() - port = os.environ.get("GANTRY_PORT", 8080) - host = os.environ.get("GANTRY_HOST", "localhost") - site = web.TCPSite( - runner, - host, - port, - ) - await site.start() - - print(f"Gantry running on {host}:{port}") - print("-------------------") - - try: - # wait for finish signal - await asyncio.Future() - except asyncio.CancelledError: - pass - finally: - await runner.cleanup() + web.run_app(app) if __name__ == "__main__": - asyncio.run(main()) + main()