feat(config): add GLAB_ names for the unprefixed variables
What does this MR do and why?
Sixteen configuration keys resolve only from an unprefixed environment variable: API_PROTOCOL, PROXY, CA_CERT, CLIENT_CERT, CLIENT_KEY, SKIP_TLS_VERIFY, CONTAINER_REGISTRY_DOMAINS, ARTIFACT_REGISTRY_DOMAINS, USE_KEYRING, GIT_PROTOCOL, BROWSER, BRANCH_PREFIX, DISPLAY_HYPERLINKS, REMOTE_ALIAS and the Duo/Orbit auto-run pair.
Names that generic are easy to collide with on a centrally managed machine, which is exactly where setting them is most useful, and a collision would silently reconfigure glab rather than fail loudly. !3827 (merged) documented these names for the first time, which makes them supported, so this is the right moment to offer a namespaced form.
Each key gains a GLAB_ name listed first, so it is the one GetFromEnvWithSource resolves, with the unprefixed name kept after it. No behavior changes for existing users. This is the convention already stated in README.md and tracked in #7999.
Deliberately out of scope
GITLAB_-prefixed names are untouched. They are already namespaced, and GITLAB_TOKEN and GITLAB_HOST in particular are shared with the wider GitLab tooling ecosystem, so renaming those is a separate deprecation with a much wider blast radius. The rule this MR applies is narrow and checkable: an unprefixed variable gains a GLAB_ name.
So api_host, ssh_host, subfolder, client_id, host and token keep exactly one name each, and it stays the GITLAB_-prefixed one. After this MR, 22 keys carry both forms and those six carry only the GITLAB_ form.
Two tests pin the rule:
TestEnvVarsForKey_EveryDocumentedKeyOffersAPrefixedName— no documented key is reachable only by an unprefixed name.TestEnvVarsForKey_PrefixedNameIsPreferred— aGLAB_name always leads, so adding one never demotes it behind a legacy name.
How to set up and validate locally
make check
D=$(mktemp -d)
GLAB_CONFIG_DIR=$D GLAB_API_PROTOCOL=http ./bin/glab config get api_protocol --host example.com # http
GLAB_CONFIG_DIR=$D API_PROTOCOL=http ./bin/glab config get api_protocol --host example.com # http, stillMR acceptance checklist
-
make lintandgo test ./...pass. -
make gen-docscommitted; the generated reference picks up the new names automatically. - Existing unprefixed names keep working, covered by
TestEnvKeyEquivalence. - Rebased onto
mainnow that !3827 (merged) has merged.