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 <noreply@anthropic.com>
This commit is contained in:
parent
1c3586eb2f
commit
c205b48be2
3
.gitignore
vendored
3
.gitignore
vendored
@ -10,3 +10,6 @@ pipekit.db-shm
|
||||
|
||||
# Local Claude Code settings.
|
||||
.claude/settings.local.json
|
||||
|
||||
# Python venv created by deploy.sh.
|
||||
.venv/
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user