Repository navigation
Conversation
`equinix init` asks whether to create a new API credential. On yes it opens the developer-settings apps page in Portal (printing the link in case no browser opens), points at the developer-settings docs, then prompts for the client ID and secret. The credentials are checked by requesting an OAuth2 token before anything is written; a blank answer, EOF, Ctrl-C, or a failed token check leaves the config file unchanged. Add EQUINIX_API_ENDPOINT (config key equinix_api_endpoint) to point the CLI at a non-production API. `init --api-endpoint` saves it, and skips the Portal instructions when the host isn't api.equinix.com. Every SDK service hardcodes https://api.equinix.com, so the standard client rewrites requests for that host to the configured endpoint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When stdin is a terminal, the client secret is read without echo (golang.org/x/term). Ctrl-C at that prompt restores the terminal before exiting. Add EQUINIX_STS_ENDPOINT (config key equinix_sts_endpoint), as in the Terraform provider, to replace https://sts.eqix.equinix.com for stsv1alpha requests. `init --sts-endpoint` saves it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The e2e workflow only runs `TestE2E_` tests in ./cmd, so the other tests (cmd init tests, internal/api, internal/casing) never ran in CI. Add a test workflow that runs the rest, and a `make test` target. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
displague
force-pushed
the
feat/init-command
branch
from
November 11, 2026 06:27
f7209f5 to
73dab17
Compare
ctreatma
previously approved these changes
Nov 11, 2026
With a non-production endpoint, still ask whether to create a new credential, and only leave out the Portal link and docs, which apply to api.equinix.com. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
equinix init, an interactive way to set up API credentials:golang.org/x/term). Ctrl-C at that prompt turns echo back on before exiting.0600. The file is edited as YAML directly rather than throughviper.WriteConfig, so values from env vars aren't written out.--configis supported, and its file doesn't need to exist yet when runninginit.API and STS endpoints
Related: equinix-labs/equinix-docs-mcp-server#54, which proposes the same variable names for the MCP server.
There was no base URL setting. cobra doesn't add env vars for flags, and the equinix-sdk-go library reads no env vars (only its examples do). Each service's
configuration.gohardcodeshttps://api.equinix.com, orhttps://sts.eqix.equinix.comfor stsv1alpha. So this PR adds the Terraform provider's names, read through viperAutomaticEnvlike the client ID and secret:initEQUINIX_API_ENDPOINTequinix_api_endpointhttps://api.equinix.com--api-endpointEQUINIX_STS_ENDPOINTequinix_sts_endpointhttps://sts.eqix.equinix.com--sts-endpointapi.NewStandardClientuses the API endpoint for the token request. It rewrites SDK requests for either production host to the configured endpoint, so every service follows the setting without changing its server list.init --api-endpoint https://mockapi.example.com, or any host other thanapi.equinix.com,initasks the same questions but leaves out the Portal link and docs, which only apply toapi.equinix.com.CI
The e2e workflow only ran
go test -run '^TestE2E_' ./cmd/..., so the other tests never ran in CI, including the existinginternal/casingones. A newtestworkflow runsgo test -skip '^TestE2E_' ./..., and there's amake testtarget.Test plan
go test ./...(in CI: e2e workflow forTestE2E_*, test workflow for the rest)init: create, decline, blank/EOF, a failed token check, both endpoint flags, and the env var.initagainst the fake API with the blanket redirect removed, then confirms afabricv4command uses the saved endpoint.internal/api: host rewrite for both endpoints, plus rejection of an endpoint without a scheme.make lint: 0 issuesmake docsregenerated🤖 Generated with Claude Code