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

Support specifying API location everywhere rather than requiring specifying index location #4208

Closed
carols10cents opened this issue Jun 22, 2017 · 11 comments · Fixed by #5990
Labels
A-interacts-with-crates.io Area: interaction with registries A-registries Area: registries C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` 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 Jun 22, 2017

@alexcrichton has expressed interest in this in places like this comment and I agree:

Ok but to be clear we don't even know what the "url of a registry" is today. The url we currently use in lots of places, the index, seems clearly inferior to the actual url like "https://crates.io".

Basically I don't think we should have to specify the location of an index anywhere ever, including within cargo's code, we should only ever have to specify the URL of the API server and that API should know where to find its index.

bors added a commit that referenced this issue Jun 24, 2017
Replace `cargo publish --host` with `cargo publish --index`

This change makes the command consistent with other versions with the same flag. `cargo publish --host` is still supported, currently marked as deprecated, or for reuse as mentioned in issue #4208.

Fixes #3797
@fa7ca7
Copy link
Contributor

fa7ca7 commented Jun 24, 2017

I can't understand. This issue supposes to change index->host. #4209 changes host->index in publish subcommand. Could please someone explain why it has been merged?

@fa7ca7
Copy link
Contributor

fa7ca7 commented Jun 24, 2017

bin/search has the same mess with host/index as bin/publish.

@carols10cents
Copy link
Member Author

I can't understand. This issue supposes to change index->host. #4209 changes host->index in publish subcommand. Could please someone explain why it has been merged?

#4209 changes the name of the argument; previously the argument was named host but needed the location of an index to work at all.

This issue is to actually take a host instead of an index location, everywhere, and the functionality of cargo and crates.io will need to be changed in order to close this issue.

Does that clear it up?

Please file a new issue for bin/search, thanks!

@fa7ca7
Copy link
Contributor

fa7ca7 commented Jun 25, 2017

Ah got it! Thank you for clarification.
Filed an issue #4219.

@ashleygwilliams
Copy link
Member

notes from chatting with @carols10cents:

  • needs to be done in a backwards compatible way
  • need to figure out the set of all things this touches
  • required for supporting multiple registries
  • host appears to have been (semi?)deprecated for index, so we need to wait a cycle to repurpose host for this (hence marking as scheduled change)

bors added a commit that referenced this issue Jul 10, 2017
Replace `cargo search --host` with `cargo search --index`

This change makes the command consistent with other versions of the same flag. `cargo search --host` is still supported, as well as `cargo search --index <index> --host <host>` in case of confusion. The three commands currently supported should produce the same behavior. All instances of `--host` are currently marked as deprecated, or for reuse as mentioned in issue #4208.

Fixes #4219
@bbatha
Copy link

bbatha commented Jul 17, 2017

I just wanted to voice my concern about this proposed change. For multiple repository hosting solutions like nexus and artifactory it needs to be possible to specify a path as well. For instance, artifactory hosts npm repos at https://host.company.com/api/npm/private so you can host multiple repos for the same package manager, e.g. https://host.company.com/api/npm/private2 or multiple repo types https://host.company.com/api/cargo/internal. Specifying just the host should have a good default but it should be overridable.

@carols10cents carols10cents changed the title Specify host everywhere instead of index Support specifying host everywhere rather than requiring specifying index location Sep 6, 2017
@carols10cents carols10cents changed the title Support specifying host everywhere rather than requiring specifying index location Support specifying API location everywhere rather than requiring specifying index location 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` 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 labels Sep 15, 2017
@carols10cents carols10cents added this to the impl period milestone Sep 15, 2017
@carols10cents carols10cents removed this from the impl period milestone Sep 15, 2017
@withoutboats
Copy link
Contributor

So I think there are two issues here which are a bit entangled:

First, it seems like a bad UX to mention https://github.com/rust-lang/crates.io-index in the user facing interface of cargo. We do this all the time (every time we update it), and in my opinion we really should instead be saying something like crates.io in that instance. As we expand support for alt registries, the same applies there I think. This seems like an unambiguous win.

Second, @carols10cents says this:

we should only ever have to specify the URL of the API server and that API should know where to find its index.

(Note that @bbatha's response is IMO a misunderstanding: while this discussion has used URL and host interchangeably, we would definitely support arbitrary URLs and you could serve multiple registries under the same domain name.)

I don't have a formed opinion about whether the API server or the index should be the "hypermedia root" of a registry's API, but today it is the case that the root is the index. The index has a config.json file in it that specifies the URL of both the API server (which is expected to implement an API like crates.io) and the crate server (which is expected to serve tarballs of crates under certain paths).

How would the migration work to a new system in which the API server reports the URL of the index instead of the other way around? What are the advantages of moving to a system that works this way? Do they outweigh the cost of that migration?

Not saying we shouldn't do this, just trying to suss out the trade off between a possibly better system and performing the migration.

@alexcrichton
Copy link
Member

This seems like an unambiguous win.

Agreed!

@carols10cents
Copy link
Member Author

carols10cents commented Jan 8, 2018

Is this moot now that we have --registry and the registries configuration where the index URL is specified? That is, should we just close this?

@withoutboats
Copy link
Contributor

There's still the stuff about crates.io saying the github index instead of something more user friendly, unless that was fixed? But maybe this should be closed and a new, narrower issue should be opened?

bors added a commit that referenced this issue Sep 9, 2018
Don't print crates.io-index URL when Updating

Following the lead from PackageId's Display, only display the registry's
URL if it's not the default registry (aka crates.io).

Before:

    $ cargo install lazy_static
        Updating registry `https://github.com/rust-lang/crates.io-index`

After:

    $ dcargo install lazy_static
        Updating crates.io index

Fixes #4208
@bors bors closed this as completed in #5990 Sep 9, 2018
@kellda
Copy link
Contributor

kellda commented Jun 8, 2020

Any update on --host status ?

fn index(&self, config: &Config) -> CargoResult<Option<String>> {
// TODO: deprecated. Remove once it has been decided `--host` can be removed
// We may instead want to repurpose the host flag, as mentioned in issue
// rust-lang/cargo#4208.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-interacts-with-crates.io Area: interaction with registries A-registries Area: registries C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` 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

Successfully merging a pull request may close this issue.

7 participants