Skip to content

Commit

Permalink
fix: remove custom GET length, 8K is sufficient for one url-encoded j…
Browse files Browse the repository at this point in the history
…son spec
  • Loading branch information
cmelone committed Mar 4, 2024
1 parent d64c5d5 commit 5a8a7a7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 29 deletions.
3 changes: 0 additions & 3 deletions docs/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
29 changes: 3 additions & 26 deletions gantry/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import asyncio
import logging
import os

Expand Down Expand Up @@ -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()

0 comments on commit 5a8a7a7

Please sign in to comment.