diff --git a/api/kiwi_vpn_api/routers/admin.py b/api/kiwi_vpn_api/routers/admin.py index 64c7307..f0ee109 100644 --- a/api/kiwi_vpn_api/routers/admin.py +++ b/api/kiwi_vpn_api/routers/admin.py @@ -77,18 +77,13 @@ async def create_initial_admin( }, ) async def set_config( - new_config: Config, - current_config: Config | None = Depends(Config.load), + config: Config, _: User | None = Depends(get_current_user_if_admin), ): """ PUT ./config: Edit `kiwi-vpn` main config. """ - # fail if not installed - if current_config is None: - raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST) - # update config file, reconnect to database - new_config.save() - Connection.connect(current_config.db.uri) + config.save() + Connection.connect(config.db.uri)