-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Make .cargo/credentials a subset of .cargo/config #4839
Conversation
I'd be a little worried if this doesn't break any tests... |
I believe this PR is correct. My understanding is we have a And the publish tests failed, which shows that the tests were using this behavior. But we should rewrite the tests and fix things to be correct. |
Ok, so things are currently pretty messy. In .cargo/config, we have [registry]
index = ".."
token = "..."
[registries.my-registry]
index = ".."
token = "..." while in .cargo/credentials we have token = "..."
[my-registry]
token = "..." IIRC What's the right thing to do here? It seems like the format of .cargo/credentials needs to change to avoid the naming conflict. We also currently load anything from .cargo/credentials, not just tokens which we may want to tighten up? |
Probably both files should use the same format, so
Maybe. It seems confusing but useful to allow anything in credentials - anything you don't want to be backed up can go there (which is probably your credentials, but maybe not). |
Cool, so .cargo/credentials would have the same layout as .cargo/config except that it only contains token fields, right? i.e. [registry]
token = "..."
[registries.my-registry]
token = "..." Do you think we need to worry about back compat for existing credentials files? |
Confirm on what credentials should look like.
If all you're doing is changing the token for alt registries, no because that's an unstable feature. |
Oh, I see. credentials has I think we need to be backwards compatible with that, so we should accept the default registry token at |
dc15873
to
4143156
Compare
Updated! |
2f0012a
to
4cc88f3
Compare
ping @withoutboats |
Oof, sorry, dropped this after the break. Could you add a test for the backcompat behavior, just to make certain we don't break anyones' workflow? Otherwise 👍 |
Previously, .cargo/credentials looked like ```toml token = "..." [my-registry] token = "..." ``` And was simply merged into the `registry` block of .cargo/config. This meant that custom registry tokens were under `registry.my-registry.token` rather than `registries.my-registry.token` which is where the index was located, and that you couldn't have a custom registry named `token` or it'd conflict with the token for the default registry. This commit changes things such that .cargo/credentials has the same layout as .cargo/config, but only contains token values. For backwards compatibility, we move `token` to `registry.token` when parsing.
4cc88f3
to
5cb5e7d
Compare
Done! |
@bors r+ |
📌 Commit 5cb5e7d has been approved by |
Make .cargo/credentials a subset of .cargo/config Previously, .cargo/credentials looked like ```toml token = "..." [my-registry] token = "..." ``` And was simply merged into the `registry` block of .cargo/config. This meant that custom registry tokens were under `registry.my-registry.token` rather than `registries.my-registry.token` which is where the index was located, and that you couldn't have a custom registry named `token` or it'd conflict with the token for the default registry. This commit changes things such that .cargo/credentials has the same layout as .cargo/config, but only contains token values. For backwards compatibility, we move `token` to `registry.token` when parsing.
☀️ Test successful - status-appveyor, status-travis |
Previously, .cargo/credentials looked like
And was simply merged into the
registry
block of .cargo/config. Thismeant that custom registry tokens were under
registry.my-registry.token
rather thanregistries.my-registry.token
which is where the index was located, and that you couldn't have a
custom registry named
token
or it'd conflict with the token for thedefault registry.
This commit changes things such that .cargo/credentials has the same
layout as .cargo/config, but only contains token values. For backwards
compatibility, we move
token
toregistry.token
when parsing.