Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(platform): Make REST & WS server host configurable #8143

Merged
merged 7 commits into from
Sep 24, 2024
7 changes: 6 additions & 1 deletion autogpt_platform/backend/backend/server/rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,12 @@ def run_service(self):

app.include_router(api_router)

uvicorn.run(app, host="0.0.0.0", port=Config().agent_api_port, log_config=None)
uvicorn.run(
app,
host=Config().agent_api_host,
port=Config().agent_api_port,
log_config=None,
)

def set_test_dependency_overrides(self, overrides: dict):
self._test_dependency_overrides = overrides
Expand Down
6 changes: 5 additions & 1 deletion autogpt_platform/backend/backend/server/ws_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,8 @@ async def websocket_router(

class WebsocketServer(AppProcess):
def run(self):
uvicorn.run(app, host="0.0.0.0", port=Config().websocket_server_port)
uvicorn.run(
app,
host=Config().websocket_server_host,
port=Config().websocket_server_port,
)
10 changes: 10 additions & 0 deletions autogpt_platform/backend/backend/util/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ class Config(UpdateTrackingModel["Config"], BaseSettings):
extra="allow",
)

websocket_server_host: str = Field(
default="0.0.0.0",
description="The host for the websocket server to run on",
)

websocket_server_port: int = Field(
default=8001,
description="The port for the websocket server to run on",
Expand All @@ -100,6 +105,11 @@ class Config(UpdateTrackingModel["Config"], BaseSettings):
description="The port for agent server daemon to run on",
)

agent_api_host: str = Field(
default="0.0.0.0",
description="The host for agent server API to run on",
)

agent_api_port: int = Field(
default=8006,
description="The port for agent server API to run on",
Expand Down
Loading