Skip to content

fix: respect gateway port from config file#1381

Closed
jasonQin6 wants to merge 2 commits intoHKUDS:mainfrom
jasonQin6:fix/gateway-port-config
Closed

fix: respect gateway port from config file#1381
jasonQin6 wants to merge 2 commits intoHKUDS:mainfrom
jasonQin6:fix/gateway-port-config

Conversation

@jasonQin6
Copy link
Copy Markdown

Problem

The nanobot gateway command ignores the gateway.port setting from the config file (~/.nanobot/config.json). The CLI --port option has a hardcoded default value of 18790, which always takes precedence over the config file setting.

Root Cause

In nanobot/cli/commands.py, the gateway function:

  1. Uses typer.Option(18790, ...) as the default port value
  2. Never reads config.gateway.port from the loaded configuration

Solution

  1. Changed --port option default to None instead of 18790
  2. Load config first, then use port or config.gateway.port to get the actual port
  3. This allows config file to set the default, while CLI --port can still override it

Testing

# With config.gateway.port = 18880 in ~/.nanobot/config.json
nanobot gateway  # Should use port 18880 from config
nanobot gateway --port 19999  # Should use port 19999 from CLI

Related

  • Config schema already defines GatewayConfig.port with default 18790 in nanobot/config/schema.py

The gateway command was using a hardcoded default port (18790) instead
of reading from config.json. Now it properly reads config.gateway.port
as the default, while still allowing --port CLI argument to override.

Fixes #192
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant