Code Monkey home page Code Monkey logo

Comments (4)

secana avatar secana commented on July 22, 2024 2

You are right. It's enough to move the download URL alone. I just implemented it and it seems to work fine. The change will be in the next Kellnr release. No breaking changes needed :)

from kellnr.

secana avatar secana commented on July 22, 2024

Good catch!

I'll separate the index and the registry api with a unique base path. Crates.io does it with different sub-domains but that solution won't work well for kellnr.

For the "download", "yank" and "unyank" on the private API: That is not an issue as they are "GET", "DELETE" and "PUT" and as such are different enough.

from kellnr.

secana avatar secana commented on July 22, 2024

As the crate registry protocol (https://doc.rust-lang.org/cargo/reference/registry-web-api.html) expects the registry API to be under /api/v1/crates/X I'll move the index to it's own path. This behavior is more similar to the behavior of crates.io where the index is on another sub-domain.

Unfortunately, this is a breaking change, as all clients of Kellnr now have to update their cargo.toml files to point to the new index. But I think a more clean solution is worth the break.

TODO: Document the change for a future kellnr 6.0.0 release.

from kellnr.

Christiaan676 avatar Christiaan676 commented on July 22, 2024

Hmmm, I would not really be fond of a breaking change in the API. At work we just migrated from the git index to the sparse index hosted with Kellnr also needing a URL change. Getting a breaking change like this would not be happily received in the organization.

Looking at the registry documentation I also get the idea that it usage of "https://crates.io/api/v1/crates" for the downloads is not what you are required to used. And setting the conig.json dl value to 'my-kellnr.com/api/v1/cratesio-registry/' or something completely different is valid.

Looking at the documentation there are 3 API's:
Index That specifies that at the configured URL in cargo there should be a config.json at the root and how the URL is build to get the index information for a crate. This is the only URL that needs to remain stable for backwards compatibility. But cargo has no requirements about the base URL. So the /api/v1/cratesio/ that kellnr uses now is fine (as long as its not classing with the web API). But also not required, hosting it at /cratesio is also fine.

WEB API The config.json 'api' field contains the base URL and the API specifies the extensions to it like: /api/v1/crates/new. This API is optional, and mainly used for publishing crates.

The download API. The config.json dl field contains the URL that is extended with /{crate}/{version}/download. If the dl field contains variables like {crate} the field is used as is.

So to mine understanding, we only need to keep the index URL's stable. All the other URLS can be moved around provided the config.json is filled with the correct values. My suggestion would be to change the config.json to for the crates.io proxy:

{
  "dl":"https://my-kellnr.nl:443/cratesio/download/",
  "auth-required":false
}

Note I removed the api field, as the crates.io proxy function does not support publishing. And currently it points to the local kellnr registry and that seams wrong. (Field is optional according to the documentation). If there are calls that need to be implemented host it under: "api":"https://my-kellnr.nl:443/cratesio/".

And the one for the crates index:

{
  "dl":"https://my-kellnr.nl:443/crates/download/",
  "api":"https://my-kellnr.nl:443/crates/",
  "auth-required":true
}

from kellnr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.