Skip to content

Commit

Permalink
feat(platform): Make REST & WS server host configurable (#8143)
Browse files Browse the repository at this point in the history
  • Loading branch information
majdyz authored Sep 24, 2024
1 parent 81d1be7 commit b78c431
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
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

0 comments on commit b78c431

Please sign in to comment.