From ecb97df3d63221e832bccf4464b8ef7b9e4469b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= <40151420+ldericher@users.noreply.github.com> Date: Sun, 20 Mar 2022 03:59:25 +0000 Subject: [PATCH] revert main.py --- api/kiwi_vpn_api/main.py | 46 ++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/api/kiwi_vpn_api/main.py b/api/kiwi_vpn_api/main.py index cfe36bc..6080fb3 100755 --- a/api/kiwi_vpn_api/main.py +++ b/api/kiwi_vpn_api/main.py @@ -17,8 +17,31 @@ from .db import Connection from .db.schemas import User from .routers import admin, user +settings = Settings.get() + app = FastAPI() +api = FastAPI( + title="kiwi-vpn API", + description="This API enables the `kiwi-vpn` service.", + contact={ + "name": "Jörn-Michael Miehe", + "email": "40151420+ldericher@users.noreply.github.com", + }, + license_info={ + "name": "MIT License", + "url": "https://opensource.org/licenses/mit-license.php", + }, + openapi_url=settings.openapi_url, + docs_url=settings.docs_url if not settings.production_mode else None, + redoc_url=settings.redoc_url if not settings.production_mode else None, +) + +api.include_router(admin.router) +api.include_router(user.router) + +app.mount("/api", api) + @app.on_event("startup") async def on_startup() -> None: @@ -34,29 +57,6 @@ async def on_startup() -> None: def main() -> None: - settings = Settings.get() - - api = FastAPI( - title="kiwi-vpn API", - description="This API enables the `kiwi-vpn` service.", - contact={ - "name": "Jörn-Michael Miehe", - "email": "40151420+ldericher@users.noreply.github.com", - }, - license_info={ - "name": "MIT License", - "url": "https://opensource.org/licenses/mit-license.php", - }, - openapi_url=settings.openapi_url, - docs_url=settings.docs_url if not settings.production_mode else None, - redoc_url=settings.redoc_url if not settings.production_mode else None, - ) - - api.include_router(admin.router) - api.include_router(user.router) - - app.mount("/api", api) - uvicorn.run( "kiwi_vpn_api.main:app", host="0.0.0.0",