App: Force plugin server to use localhost (#18976)

This commit is contained in:
Ethan Harris 2023-11-09 13:49:22 +00:00 committed by GitHub
parent 4af961fffe
commit ec374ab307
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -201,8 +201,9 @@ async def _healthz() -> Dict[str, str]:
return {"status": "ok"}
def _start_plugin_server(host: str, port: int) -> None:
def _start_plugin_server(port: int) -> None:
"""Start the plugin server which can be used to dispatch apps or run plugins."""
fastapi_service = FastAPI()
fastapi_service.add_middleware(
@ -216,4 +217,9 @@ def _start_plugin_server(host: str, port: int) -> None:
fastapi_service.post("/v1/runs")(_run_plugin)
fastapi_service.get("/healthz", status_code=200)(_healthz)
uvicorn.run(app=fastapi_service, host=host, port=port, log_level="error")
uvicorn.run(
app=fastapi_service,
host="127.0.0.1",
port=port,
log_level="error",
)

View File

@ -24,7 +24,7 @@ def mock_plugin_server(mock_uvicorn) -> TestClient:
mock_uvicorn.run.side_effect = create_test_client
_start_plugin_server("0.0.0.0", 8888) # noqa: S104
_start_plugin_server(8888)
return test_client["client"]