-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Problem
I have multiple distinct accounts on crates.io for which I publish crates. I would prefer to be able to stay logged in to all these accounts simultaneously.
Proposed Solution
Perhaps namespace support in git-credential-manager is a good reference. Currently this is how I handle my multiple git identities.
But on second thought, maybe namespace support leads to too many edge cases and orthogonality concerns with multiple registries, and is frankly overkill for what I want. So perhaps a registry.identities (and the corresponding registries.<name>.identities) table? It would look something like this:
[registry.identities]
alice = { token = "TOKEN_ALICE" }
bob = { token = "TOKEN_BOB" }So this would be an opt-in "named identity" feature, and the current system would be then known as "unnamed identity". Everything right now would work the same because "unnamed identity" would still be the default mode of operation. But now with an additional CLI option --identity <who> (for cargo login, cargo logout, and cargo publish), cargo would read and write these "named identity" fields instead.
Notes
Previously I have been saving the tokens to local files, and then using cargo publish --token to dynamically select which one I use. I had this all written in a script. But more recently cargo publish --token has been marked as deprecated, so now I'm looking elsewhere.
The easiest thing for me to do right now to "just make it work" would be to switch to the CARGO_REGISTRY_TOKEN environment variable. Or I can create multiple named registries that each represent an identity, but are all in fact crates.io, thereby coaxing the current multiple registry support to act as multiple identity support. But at this point the amount of gymnastics I'm doing plus my presumption that this may be a common need would warrant asking for proper upstream support.