How to configure crates.io mirror through environment variables

⚓ Rust    📅 2025-08-21    👤 surdeus    👁️ 4      

surdeus

Normally if you want use a mirror instead of crates.io, you configure it in .cargo/config.toml:

[source.crates-io]
replace-with = "mirror-local"

[registries.mirror-local]
index = "http://mirror.local/rust/crates.io-index"

I need to configure it through environment variables (I'm running renovate which doesn't allow me to set the .cargo/config.toml file).
I've tried to override the crates.io url with CARGO_REGISTRIES_CRATES_IO_INDEX=http://mirror.local/rust/crates.io-index but cargo still tries to use crates.io.

Is there another way I can configure this?

5 posts - 2 participants

Read full topic

🏷️ Rust_feed