From c205b48be23eafb50aeeb79f0c583bd082a3500a Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Thu, 23 Apr 2026 00:33:56 -0400 Subject: [PATCH] Honor api_host in config.yaml; ignore .venv/ created by deploy.sh. cmd_serve now reads api_host from Config with a 127.0.0.1 safe default, matching the existing api_port pattern. --host/--port CLI flags still override. Local config is bumped to bind 0.0.0.0:8200. Co-Authored-By: Claude Opus 4.7 --- .gitignore | 3 +++ config.yaml | 3 ++- pipekit/cli.py | 9 ++++++--- pipekit/config.py | 4 ++++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 113aed5..1946d3b 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,6 @@ pipekit.db-shm # Local Claude Code settings. .claude/settings.local.json + +# Python venv created by deploy.sh. +.venv/ diff --git a/config.yaml b/config.yaml index 62ecd84..6255896 100644 --- a/config.yaml +++ b/config.yaml @@ -1,7 +1,8 @@ database: /opt/pipekit/pipekit.db jrunner_path: /usr/local/bin/jrunner driver_dir: /opt/pipekit/drivers/ -api_port: 8100 +api_host: 0.0.0.0 +api_port: 8200 # smtp: # host: smtp.example.com # port: 587 diff --git a/pipekit/cli.py b/pipekit/cli.py index 2e4feca..89e6846 100644 --- a/pipekit/cli.py +++ b/pipekit/cli.py @@ -137,8 +137,10 @@ def cmd_serve(args) -> int: import uvicorn from .api import create_app - port = args.port or get_config().api_port - uvicorn.run(create_app(), host=args.host, port=port, reload=args.reload) + cfg = get_config() + host = args.host or cfg.api_host + port = args.port or cfg.api_port + uvicorn.run(create_app(), host=host, port=port, reload=args.reload) return 0 @@ -309,7 +311,8 @@ def main(argv: list[str] | None = None) -> int: p_run.set_defaults(func=cmd_run) p_serve = sub.add_parser("serve", help="start the HTTP API") - p_serve.add_argument("--host", default="127.0.0.1") + p_serve.add_argument("--host", default=None, + help="defaults to config.yaml api_host (127.0.0.1)") p_serve.add_argument("--port", type=int, default=None, help="defaults to config.yaml api_port") p_serve.add_argument("--reload", action="store_true") diff --git a/pipekit/config.py b/pipekit/config.py index 7e12e5e..d3aefb7 100644 --- a/pipekit/config.py +++ b/pipekit/config.py @@ -28,6 +28,10 @@ class Config: def api_port(self) -> int: return int(self._data.get("api_port", 8100)) + @property + def api_host(self) -> str: + return str(self._data.get("api_host", "127.0.0.1")) + def get(self, key: str, default=None): return self._data.get(key, default)