-
Notifications
You must be signed in to change notification settings - Fork 229
Store credentials in a config directory #3092
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
final legacyCredentialsFile = _legacyCredentialsFile(cache); | ||
if (entryExists(legacyCredentialsFile)) { | ||
log.message('Also deleting legacy credentials at $legacyCredentialsFile'); | ||
deleteEntry(legacyCredentialsFile); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it make more sense if we move legacy credentials file into new path instead of deleting? It would be backwards-compatible with CI jobs that uses credentials.json for authentication & publishing packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we are in the dart pub logout
code - it should delete any credentials, so I don't think it makes sense to keep the legacy ones.
In the code for _credentialsFile
below we use the credentials file from the legacy location if it exists there. We could consider moving it, but that would make it hard(er) to switch between older and newer versions of pub.
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry, 😅 haven't noticed it's for logout command.
@@ -89,7 +89,7 @@ class SystemCache { | |||
/// Defaults to `false`. | |||
SystemCache({String rootDir, bool isOffline = false}) | |||
: rootDir = rootDir ?? SystemCache.defaultDir, | |||
tokenStore = TokenStore(rootDir ?? SystemCache.defaultDir) { | |||
tokenStore = TokenStore(dartConfigDir) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also rename tokens.json
to pub-tokens.json
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes!
Done!
Fixes: #2999