mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Add FastAPI roles controller, de-duplicate app initialization for FastAPI.
This commit is contained in:
+2
-10
@@ -1,6 +1,4 @@
|
||||
import uvicorn
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.wsgi import WSGIMiddleware
|
||||
from galaxy_main import (
|
||||
GalaxyConfigBuilder,
|
||||
main,
|
||||
@@ -8,6 +6,7 @@ from galaxy_main import (
|
||||
|
||||
from galaxy.util.properties import load_app_properties
|
||||
from galaxy.webapps.galaxy.buildapp import app_factory
|
||||
from galaxy.webapps.galaxy.fast_app import initialize_fast_app
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
@@ -17,14 +16,7 @@ def wsgiloop(args, log):
|
||||
kwds = config_builder.app_kwds()
|
||||
kwds = load_app_properties(**kwds)
|
||||
gx = app_factory(global_conf=config_builder.global_conf(), **kwds)
|
||||
wsgi_handler = WSGIMiddleware(gx)
|
||||
|
||||
# app factory will import api controllers while passing in app object,
|
||||
# this needs to happen before we can import the router from individual api modules
|
||||
# (until we've replaced everything with FastAPI, at which point we can do normal imports).
|
||||
from galaxy.webapps.galaxy.api import jobs
|
||||
app.include_router(jobs.router, prefix='/api/jobs')
|
||||
app.mount('/', wsgi_handler)
|
||||
initialize_fast_app(gx, app=app)
|
||||
uvicorn.run(app)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user