diff --git a/api/kiwi_vpn_api/main.py b/api/kiwi_vpn_api/main.py index 86ae4f2..5583198 100755 --- a/api/kiwi_vpn_api/main.py +++ b/api/kiwi_vpn_api/main.py @@ -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") diff --git a/api/kiwi_vpn_api/routers/__init__.py b/api/kiwi_vpn_api/routers/__init__.py index a0e21a9..9b6ebbd 100644 --- a/api/kiwi_vpn_api/routers/__init__.py +++ b/api/kiwi_vpn_api/routers/__init__.py @@ -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)