feat: read the connection settings from ASCENDER_ environment variables - #72
Merged
Merged
Conversation
Every connection setting the client takes from the environment now answers to an ASCENDER_ name: ASCENDER_HOST, ASCENDER_OAUTH_TOKEN, ASCENDER_TOKEN, ASCENDER_USERNAME, ASCENDER_PASSWORD, ASCENDER_VERIFY_SSL, ASCENDER_VERBOSE, ASCENDER_FORMAT and ASCENDER_COLOR. This is the same shape as ascender-manage: the new name is what the documentation says, and the old ones keep working. The nesting is what made this worth a helper rather than one more level of env.get. The token was already four deep, and adding two more spellings inside it would have put the default out of sight of the name it belongs to. env_default takes the suffix and the ordered prefixes instead, so the precedence is stated once and every argument reads the same way. Precedence is ASCENDER_, then CONTROLLER_, then TOWER_, prefix before suffix, so ASCENDER_TOKEN beats CONTROLLER_OAUTH_TOKEN: the prefix says which release the script was written against, where the suffix is only a spelling. Below the new prefix the old chain keeps the order it already had, and a name that is set but empty still wins over a later one, which is what the nested env.get calls did. ascender login -f human prints the ASCENDER_ name now. Both are read, so a shell that already sourced the old line keeps working. The integration tests that prove the token path works by stripping the username and password out of the environment now strip all three prefixes. With only one of them removed, a developer with the older spelling exported would have stayed authenticated by password and the tests would have passed without exercising the token at all.
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
cigamit
approved these changes
Sep 14, 2026
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.
Every connection setting the client takes from the environment now answers to an
ASCENDER_name:ASCENDER_HOST,ASCENDER_OAUTH_TOKEN,ASCENDER_TOKEN,ASCENDER_USERNAME,ASCENDER_PASSWORD,ASCENDER_VERIFY_SSL,ASCENDER_VERBOSE,ASCENDER_FORMATandASCENDER_COLOR.Same shape as
ascender-manage: the new name is what the documentation says, and the old ones keep working.Why a helper rather than one more level of
env.getThe token lookup was already four deep:
Adding two more spellings inside that would have put the default out of sight of the argument it belongs to.
env_defaulttakes the suffix and walks the prefixes, so the precedence is stated once and every argument reads the same way:Precedence
ASCENDER_, thenCONTROLLER_, thenTOWER_, prefix before suffix. SoASCENDER_TOKENbeatsCONTROLLER_OAUTH_TOKEN: the prefix says which release the script was written against, where the suffix is only a spelling of the same thing. Below the new prefix the old chain keeps exactly the order it had, and a name that is set but empty still wins over a later one, which is what the nestedenv.getcalls did.One behaviour change
ascender login -f humanprintsexport ASCENDER_OAUTH_TOKEN=rather thanexport CONTROLLER_OAUTH_TOKEN=. Both are read, so a shell that already sourced the old line keeps working.Checking
Eight tests name the precedence one rule at a time, and two more go through
parse_argsso the wiring is covered rather than just the helper. Both kinds fail against the old code rather than passing regardless.The integration tests that prove the token path works by stripping the username and password out of the environment now strip all three prefixes. With only one removed, a developer with an older spelling exported would have stayed authenticated by password and those tests would have passed without exercising the token at all.
378 unit tests pass,
ruff format --checkandruff checkare clean, and the documentation builds with-W.