panamax-rs / panamax

Mirror rustup and crates.io repositories, for offline Rust and cargo usage.
Apache License 2.0
427 stars 45 forks source link

Environment Variables example? #93

Open damccull opened 1 year ago

damccull commented 1 year ago

Hello,

I'm interested in setting up my local mirror such that I can easily enable it by setting one environment variable, or disable it by unsetting it.

I have attempted to set it up as both a registry and a source, but the issue I'm running into is that I need to somehow set source.cargo-io's 'index' value via an environment variable. The docs say I should be able to set CARGO_SOURCE_<sourcename>_INDEX, but I am unsure how to represent the source name here. Using a -, such as CARGO_SOURCE_CRATES-IO_INDEX is invalid under linux, and replacing the dash with a single or double underscore, or omitting it entirely doesn't work.

How can I set the crates-io replacement key via environment variable? This would allow me to set up a source in my config but only to enable it when necessary.

Thanks.

k3d3 commented 1 year ago

Unfortunately, I have no idea how to do this. For testing, in ~/.cargo I've just had a config.toml (with nothing in it) and a config file, and just moving the latter to config.bak whenever I didn't want to use the mirror. It's pretty hacky though.