-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d7313f
commit fd7a0aa
Showing
5 changed files
with
14 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
from fastapi import FastAPI | ||
|
||
from plombery.api.authentication import init_auth | ||
from plombery.api.authentication import build_auth_router | ||
from plombery._version import __version__ | ||
from plombery.websocket import install_socketio_server | ||
from .middlewares import SPAStaticFiles, setup_cors | ||
from .routers import pipelines, runs | ||
from plombery.websocket import asgi | ||
from plombery.api.middlewares import SPAStaticFiles, setup_cors | ||
from plombery.api.routers import pipelines, runs | ||
|
||
|
||
API_PREFIX = "/api" | ||
|
||
app = FastAPI(title="Plombery", version=__version__, redirect_slashes=False) | ||
|
||
# Mount the websocket before the other middlewares | ||
# to avoid conflicts | ||
app.mount("/ws", asgi, name="socket") | ||
|
||
setup_cors(app) | ||
auth_router = init_auth(app) | ||
|
||
app.include_router(pipelines.router, prefix=API_PREFIX) | ||
app.include_router(runs.router, prefix=API_PREFIX) | ||
app.include_router(auth_router, prefix=API_PREFIX) | ||
|
||
combined_app = install_socketio_server(app) | ||
app.include_router(build_auth_router(app), prefix=API_PREFIX) | ||
|
||
app.mount("/", SPAStaticFiles(api_prefix=API_PREFIX)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
from fastapi import FastAPI | ||
import socketio | ||
|
||
|
||
sio = socketio.AsyncServer(async_mode="asgi", cors_allowed_origins="*") | ||
|
||
|
||
def install_socketio_server(app: FastAPI): | ||
return socketio.ASGIApp(socketio_server=sio, other_asgi_app=app) | ||
asgi = socketio.ASGIApp(socketio_server=sio) |