Use a crates.io mirror for all operatings

I have an artifactory mirror of crates.io for builds in my CI/CD environment. The builder machines have no access to the internet except through artifactory. I've got the follow ~/.cargo/config.toml

[registry]
default = "crate-proxy"

[registries]
crate-proxy = { index = "http://arti.mycompant.com/artifactory/git/crate-proxy.git }

It seems this is being ignored by certain commands like cargo build which is still attempting to reach crates.io. Removing Cargo.lock and running cargo update still shows "Updating crates.io" and Cargo.lock still shows source = "registry+https://github.com/rust-lang/crates.io-index"

What do I need to do to always use my mirror?

You need to use source-replacement feature, not custom registries.

Your configuration says it's okay to use crates.io, and this registry is just a completely separate thing for other crates that aren't on crates.io.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.