]> git.proxmox.com Git - cargo.git/commit
Read configuration from environment variables
authorAlex Crichton <alex@alexcrichton.com>
Fri, 19 Feb 2016 08:07:22 +0000 (00:07 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Fri, 19 Feb 2016 08:18:13 +0000 (00:18 -0800)
commita40440c6844367eecd42f5043d9904e5f5b50d2f
tree080ca1ad950c3dbdb60acbab1836a5808a6c9653
parent56db20dffadf13f76c502872ccbe75398e996e3a
Read configuration from environment variables

This commit adds a more principled system to rationalize what ends up being a
configuration value versus an environment variable. This problem is solved by
just saying that they're one and the same! Similar to Bundler, this commit
supports overriding the `foo.bar` configuration value with the `CARGO_FOO_BAR`
environment variable.

Currently this is used as part of the `get_string` and `get_i64` methods on
`Config`. This means, for example, that the following environment variables can
now be used to configure Cargo:

* CARGO_BUILD_JOBS
* CARGO_HTTP_TIMEOUT
* CARGO_HTTP_PROXY

Currently it's not supported to encode a list in an environment variable, so for
example `CARGO_PATHS` would not be read when reading the global `paths`
configuration value.

cc #2362
cc #2395 -- intended to close this in tandem with #2397
src/cargo/util/config.rs
src/cargo/util/errors.rs
src/doc/config.md
tests/test_cargo_config.rs [new file with mode: 0644]
tests/tests.rs