sourcegraph / sourcegraph-public-snapshot

Code AI platform with Code Search & Cody
https://sourcegraph.com
Other
10.1k stars 1.27k forks source link

Rust: stop hardcoding the crates.io registry URL #37694

Open olafurpg opened 2 years ago

olafurpg commented 2 years ago

In https://github.com/sourcegraph/sourcegraph/pull/37064, we added support to sync crates with an "index repository" like github.com/rust-lang/crates.io-index. The root of that repository contains a config.json file that points to a registry URL https://github.com/rust-lang/crates.io-index/blob/master/config.json

We currently hardcode the crates.io URL when downloading crates https://github.com/sourcegraph/sourcegraph/blob/0642347ef8014250468d8e8ececadc700739fa84/cmd/gitserver/server/vcs_syncer_rust_packages.go#L64

We should replace that code with the registry URL from config.json

olafurpg commented 2 years ago

We now download from the crates.io CDN instead of API. The CDN is not available in config.json so we may need to add a new "cdn" code host setting to optionally allow downloading from a CDN instead of the "dl" setting from config.json.