Skip to content

cli: add --api-port to hflow up - #57

Closed
chintondutta wants to merge 1 commit into
Hebbian-Robotics:mainfrom
chintondutta:feat/7-cli-api-port
Closed

cli: add --api-port to hflow up#57
chintondutta wants to merge 1 commit into
Hebbian-Robotics:mainfrom
chintondutta:feat/7-cli-api-port

Conversation

@chintondutta

Copy link
Copy Markdown
Contributor

Fixes #7.

Current behavior

The runtime config already supports a custom API port -- RuntimeConfig.api_port: int = 8080, rendered into the bundle's .env as API_PORT -- but hflow up never passed it, so docs/RUNTIME.md's "Port 8080 is taken" entry had to document a manual .env-edit workaround.

Change

  • Added --api-port (type int, default 8080, matching RuntimeConfig's own default) to the up subparser, forwarded into the RuntimeConfig(...) construction in _command_up.
  • Updated the "Port 8080 is taken" troubleshooting entry in docs/RUNTIME.md to point at the flag -- while keeping the existing, still-true caveat: an existing bundle's .env is create-if-absent and never rewritten (so secrets and user edits survive re-renders), so --api-port only takes effect on a bundle's first render. For an already-rendered bundle, .env still needs a direct edit.

Testing

New test test_up_honors_api_port (tests/test_runtime_cli.py), following the existing test_up_renders_starts_and_prints pattern (compose subprocess and Airflow health stubbed, no Docker): runs hflow up --api-port 9090 and asserts the rendered bundle's .env contains API_PORT=9090 and the printed summary uses http://127.0.0.1:9090.

uv run pytest -q       # 298 passed, 3 skipped; unrelated: tests/test_ffmpeg.py fails/errors in this sandbox (no ffmpeg/ffprobe on PATH)
uv run ruff check --fix
uv run ruff format
uv run ty check
docker run --rm -v "$PWD:/data" -w /data lycheeverse/lychee:latest --no-progress --include-fragments \
  --exclude '^https://github\.com/Hebbian-Robotics/hflow/(issues|security/advisories/new)$' \
  --exclude-path references/mcap-spec.md \
  --exclude-path references/foxglove-CompressedVideo.proto .
# 230 Total, 0 Errors

(lychee wasn't on PATH in this sandbox; ran it via the official Docker image instead of installing.)

RuntimeConfig already supported a custom api_port, but hflow up never
exposed it, so docs/RUNTIME.md had to document hand-editing the bundle's
.env as the only way to change it. Add the flag (default 8080, matching
RuntimeConfig's default) and forward it into RuntimeConfig construction.

Also clarifies the "Port 8080 is taken" troubleshooting entry: the flag
only takes effect on a bundle's first render, since an existing .env is
never rewritten (so user edits and secrets survive re-renders) -- an
already-rendered bundle still needs .env edited directly.
@github-actions

Copy link
Copy Markdown

👋 Hi @chintondutta — thanks for the contribution! To keep starter issues available
for other contributors and give every pull request a real review, we accept
1 open pull request per contributor at a time.

You already have #52 open, so this one is being closed automatically.
Once your open pull request is merged or closed, feel free to reopen this one —
no work is lost.

@github-actions github-actions Bot closed this Aug 20, 2026
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.

CLI: add --api-port to hflow up instead of hand-editing .env

1 participant