fix(cli): remove defaulting to keyring when --global-config set (#20943)

This fixes a regression that caused the VS code extension to be unable
to authenticate after making keyring usage on by default. This is
because the VS code extension assumes the CLI will always use the
session token stored on disk, specifically in the directory specified by
--global-config.

This fix makes keyring usage enabled when the --global-config directory
is not set. This is a bit wonky but necessary to allow the extension to
continue working without modification and without backwards compat
concerns. In the future we should modify these extensions to either
access the credential in the keyring (like Coder Desktop) or some other
approach that doesn't rely on the session token being stored on disk.

Tests:
`coder login dev.coder.com` -> token stored in keyring
`coder login --global-config=/tmp/ dev.coder.com` -> token stored in
`/tmp/session`
This commit is contained in:
Zach
2025-11-26 10:17:31 +01:00
committed by GitHub
parent c87c33f7dd
commit bbf7b137da
6 changed files with 38 additions and 20 deletions
+1 -1
View File
@@ -179,7 +179,7 @@ Disable network telemetry. Network telemetry is collected when connecting to wor
| Environment | <code>$CODER_USE_KEYRING</code> |
| Default | <code>true</code> |
Store and retrieve session tokens using the operating system keyring. Enabled by default. If the keyring is not supported on the current platform, file-based storage is used automatically. Set to false to force file-based storage.
Store and retrieve session tokens using the operating system keyring. This flag is ignored and file-based storage is used when --global-config is set or keyring usage is not supported on the current platform. Set to false to force file-based storage on supported platforms.
### --global-config