revert main.py

This commit is contained in:
Jörn-Michael Miehe 2022-03-20 03:59:25 +00:00
parent e49a993676
commit ecb97df3d6

View file

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