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",