Skip to content

fix(cli): honour --endpoint and AWS_ENDPOINT_URL, and make status work again - #173

Merged
DaviReisVieira merged 1 commit into
mainfrom
fix/cli-endpoint-resolution
Sep 22, 2026
Merged

DaviReisVieira merged 1 commit into
mainfrom
fix/cli-endpoint-resolution

Conversation

@DaviReisVieira

Copy link
Copy Markdown
Owner

Fixes #171

Problem

stackport list, describe and status take --endpoint and honour AWS_ENDPOINT_URL, but only on a machine that never opened the web UI. Once ~/.stackport/endpoints.json exists, the saved default wins and both are ignored.

On top of that, stackport status has been failing for everyone: it called _probe_service(svc) without the endpoint_url that helper requires, and exited 2 with "missing 1 required positional argument".

Cause

The commands wrote os.environ["AWS_ENDPOINT_URL"] after backend.config had already read and deleted that variable, so nothing in StackPort read it. get_client() with no endpoint_url resolves through the endpoint store, which loads the saved file. The fresh-machine cases only worked because botocore picks the variable up on its own.

Fix

  • One helper resolves the endpoint per command: explicit --endpoint (or AWS_ENDPOINT_URL at startup) wins, otherwise the saved default, the same one the web UI uses
  • get_client and _probe_service receive endpoint_url and region explicitly
  • The os.environ writes are gone

Verified

Against my own ~/.stackport (saved default local = 4566), with nothing listening on 4599 so the error shows the URL called:

configuration before after
AWS_ENDPOINT_URL=...:4599, fresh data dir 4599 4599
AWS_ENDPOINT_URL=...:4599, existing ~/.stackport 4566 4599
--endpoint ...:4599, fresh data dir 4599 4599
--endpoint ...:4599, existing ~/.stackport 4566 4599
no flag, no env, existing ~/.stackport 4566 4566

stackport status --endpoint http://localhost:4566 against MiniStack: 35 services, 35 available.

Four new tests pin the behaviour: flag reaches get_client for list and describe, no flag falls back to the saved default, and status probes every service at the given endpoint. Full backend suite: 544 passed.

The CLI commands set os.environ["AWS_ENDPOINT_URL"] after backend.config
had already read and deleted it, so nothing in StackPort saw the value.
get_client() then fell through to the saved default in
~/.stackport/endpoints.json, and --endpoint / AWS_ENDPOINT_URL were
ignored on any machine that had opened the web UI once.

Resolve the endpoint once per command (explicit flag or env var wins,
otherwise the saved default) and hand it to get_client and
_probe_service explicitly. This also fixes `stackport status`, which
called _probe_service without its required endpoint_url and exited 2
with "missing 1 required positional argument".

Fixes #171
@DaviReisVieira
DaviReisVieira merged commit 1dfb58a into main Sep 22, 2026
2 checks passed
@DaviReisVieira
DaviReisVieira deleted the fix/cli-endpoint-resolution branch September 22, 2026 00:47
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 ignores --endpoint and AWS_ENDPOINT_URL once ~/.stackport/endpoints.json exists

1 participant