fix: read legacy ~/.upstash.json so 0.x users stay logged in - #14
Merged
Conversation
The 1.0 rewrite moved credentials to ~/.config/upstash/config.json and renamed the JSON key apiKey -> api_key, so users upgrading from the 0.x CLI silently appeared logged out. readConfig() now falls back to the legacy ~/.upstash.json (accepting the old camelCase apiKey) when no new config is present. The new config still takes precedence, so re-running `upstash login` transparently migrates them.
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.
The 1.0 rewrite moved saved credentials from
~/.upstash.jsonto~/.config/upstash/config.jsonand renamed the JSON keyapiKeytoapi_key. As a result, anyone upgrading from the 0.x CLI silently appears logged out (and any script passing the old-c/--configflag already errors).This adds a read-only fallback so existing users keep working:
readConfig()now reads the new config first, then falls back to the legacy~/.upstash.json, accepting either the newapi_keyor the legacyapiKey.upstash logintransparently migrates a user onto the new path.UPSTASH_LEGACY_CONFIG_HOME(mirrorsUPSTASH_CONFIG_HOME) purely so tests stay isolated.Scope is intentionally small: this is read-only. We never write or delete
~/.upstash.json(upstash logoutstill only manages the new file).Tests: 3 new unit tests cover the legacy read, new-over-legacy precedence, and a malformed legacy file. Typecheck + build + unit suite green.