frewsxcv / rust-crates-index

Rust library for retrieving and interacting with the crates.io index
https://docs.rs/crates-index/
Apache License 2.0
72 stars 37 forks source link

Fix config parsing #117

Closed Jake-Shadle closed 1 year ago

Jake-Shadle commented 1 year ago

The logic for finding whether the crates.io index had been source replaced was incorrect. If any valid config.toml was found, it would be probed for whether the source replacement key was defined, otherwise use the default and move on with initialization. This would mean if you did have source replacement enabled in a config.toml further up the chain, or in CARGO_HOME, it would not be resolved properly. This was resolved by combining the key reading with the hierarchy traversal, so that all valid configs are traversed until the first config that actually defines a valid source replacement is located.