revert main.py
This commit is contained in:
parent
e49a993676
commit
ecb97df3d6
1 changed files with 23 additions and 23 deletions
|
@ -17,8 +17,31 @@ from .db import Connection
|
||||||
from .db.schemas import User
|
from .db.schemas import User
|
||||||
from .routers import admin, user
|
from .routers import admin, user
|
||||||
|
|
||||||
|
settings = Settings.get()
|
||||||
|
|
||||||
app = FastAPI()
|
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")
|
@app.on_event("startup")
|
||||||
async def on_startup() -> None:
|
async def on_startup() -> None:
|
||||||
|
@ -34,29 +57,6 @@ async def on_startup() -> None:
|
||||||
|
|
||||||
|
|
||||||
def main() -> 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(
|
uvicorn.run(
|
||||||
"kiwi_vpn_api.main:app",
|
"kiwi_vpn_api.main:app",
|
||||||
host="0.0.0.0",
|
host="0.0.0.0",
|
||||||
|
|
Loading…
Reference in a new issue