Skip to content
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

cargo login should allow for multiple tokens, one per registry, to be saved in ~/.cargo/credentials #3365

Closed
carols10cents opened this issue Dec 3, 2016 · 2 comments
Labels
A-registries Area: registries C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-login S-needs-mentor Status: Issue or feature is accepted, but needs a team member to commit to helping and reviewing. T-cargo Team: Cargo

Comments

@carols10cents
Copy link
Member

carols10cents commented Dec 3, 2016

Because I'm working on crates.io locally and testing out publish, and because I'm interested in being able to publish to a private registry in the future, it's annoying that I have to cargo login again when I want to publish to crates.io again instead.

cargo login --help shows a --host option like cargo publish has, but specifying my local crates.io index to cargo login --host still overwrites all the content in ~/.cargo/config.

It looks like the only thing --host is used for right now is if you call cargo login without a token: println!("please visit {}me and paste the API Token below", host);

Related to rust-lang/rfcs#2141, namely, I think this is similar to, but not dependent on, #4498 so that we can say cargo login --registry myregistry and cargo will put this in .cargo/credentials, which will match up with the registry configuration in .cargo/config specified in rust-lang/rfcs#2141:

[registries.myregistry]
token = "abcdefg"

I think it could literally just append this to the file (replacing any existing token for registries.myregistry; nicer would be if it complained if registries.myregistry didn't appear in any .cargo/config.

Although I guess it does depend on #4498 to actually be useful, since otherwise cargo wouldn't know when it should use this token :)

@alexcrichton
Copy link
Member

alexcrichton commented Dec 28, 2016

This sounds reasonable to me! If we change the format of ~/.cargo/credentials we just need to make sure it's backcompat, but otherwise I'm open to modifications.

@carols10cents carols10cents changed the title cargo login --host should allow for multiple tokens, one per host, to be saved in ~/.cargo/config cargo login --host should allow for multiple tokens, one per host, to be saved in ~/.cargo/credentials Sep 6, 2017
@carols10cents carols10cents changed the title cargo login --host should allow for multiple tokens, one per host, to be saved in ~/.cargo/credentials cargo login should allow for multiple tokens, one per registry, to be saved in ~/.cargo/credentials Sep 15, 2017
@carols10cents carols10cents added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-login S-needs-mentor Status: Issue or feature is accepted, but needs a team member to commit to helping and reviewing. T-cargo Team: Cargo A-registries Area: registries and removed Command-publish labels Sep 15, 2017
@carols10cents
Copy link
Member Author

This should have been closed except that GitHub doesn't understand "and" 😂😂😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-registries Area: registries C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-login S-needs-mentor Status: Issue or feature is accepted, but needs a team member to commit to helping and reviewing. T-cargo Team: Cargo
Projects
None yet
Development

No branches or pull requests

2 participants