Refactor GitLab webhook initialization to move app setup outside of start function

This commit is contained in:
Ori Kotek
2024-06-03 12:38:41 +03:00
parent 413547f404
commit 76ff49d446

View File

@ -133,7 +133,6 @@ def handle_ask_line(body, data):
async def root(): async def root():
return {"status": "ok"} return {"status": "ok"}
def start():
gitlab_url = get_settings().get("GITLAB.URL", None) gitlab_url = get_settings().get("GITLAB.URL", None)
if not gitlab_url: if not gitlab_url:
raise ValueError("GITLAB.URL is not set") raise ValueError("GITLAB.URL is not set")
@ -142,6 +141,8 @@ def start():
app = FastAPI(middleware=middleware) app = FastAPI(middleware=middleware)
app.include_router(router) app.include_router(router)
def start():
uvicorn.run(app, host="0.0.0.0", port=3000) uvicorn.run(app, host="0.0.0.0", port=3000)