minor refactoring
This commit is contained in:
parent
53cb7c9c1e
commit
e078c7b094
2 changed files with 8 additions and 5 deletions
|
@ -16,6 +16,8 @@ from .config import Config, Settings
|
|||
from .db import Connection, User
|
||||
from .routers import main_router
|
||||
|
||||
settings = Settings._
|
||||
|
||||
app = FastAPI(
|
||||
title="kiwi-vpn API",
|
||||
description="This API enables the `kiwi-vpn` service.",
|
||||
|
@ -27,12 +29,12 @@ app = FastAPI(
|
|||
"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,
|
||||
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,
|
||||
)
|
||||
|
||||
app.include_router(main_router, prefix=f"/{Settings._.api_v1_prefix}")
|
||||
app.include_router(main_router)
|
||||
|
||||
|
||||
@app.on_event("startup")
|
||||
|
|
|
@ -6,11 +6,12 @@ This file: Main API router definition.
|
|||
|
||||
from fastapi import APIRouter
|
||||
|
||||
from ..config import Settings
|
||||
from . import admin, device, user
|
||||
|
||||
main_router = APIRouter()
|
||||
|
||||
main_router.include_router(admin.router)
|
||||
main_router.include_router(admin.router, prefix=f"/{Settings._.api_v1_prefix}")
|
||||
main_router.include_router(device.router)
|
||||
main_router.include_router(user.router)
|
||||
|
||||
|
|
Loading…
Reference in a new issue