Allow controller to be reloaded using the API. Fixes #1743

This commit is contained in:
grossmj 2021-06-04 17:01:07 +09:30
parent 8be015cd86
commit f64b5cd9b6
2 changed files with 15 additions and 2 deletions

View File

@ -67,6 +67,19 @@ def check_version(version: schemas.Version) -> dict:
return {"version": __version__}
@router.post(
"/reload",
dependencies=[Depends(get_current_active_user)],
status_code=status.HTTP_204_NO_CONTENT,
)
async def reload() -> None:
"""
Reload the controller
"""
await Controller.instance().reload()
@router.post(
"/shutdown",
dependencies=[Depends(get_current_active_user)],
@ -75,7 +88,7 @@ def check_version(version: schemas.Version) -> dict:
)
async def shutdown() -> None:
"""
Shutdown the local server
Shutdown the server
"""
if Config.instance().settings.Server.local is False:

View File

@ -1,4 +1,4 @@
uvicorn==0.13.4
uvicorn==0.14.0
fastapi==0.65.1
websockets==9.1
python-multipart==0.0.5