Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: read settings from environment variables as well as command line #2395

Closed
edunham opened this issue Feb 18, 2016 · 1 comment

Comments

@edunham
Copy link
Member

edunham commented Feb 18, 2016

In the Rust build system, all actual calls to Cargo are buried within several layers of scripts, but it's easy to set environment variables. If others try to automate the builds of Rust projects that use Cargo, they may encounter similar challenges.

In the case that caused me to file this issue, it would be convenient for Cargo to read a var like CARGO_VERBOSE instead of only the command-line --verbose when deciding how much debug info to print.

alexcrichton added a commit to alexcrichton/cargo that referenced this issue Feb 19, 2016
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 rust-lang#2362
cc rust-lang#2395 -- intended to close this in tandem with rust-lang#2397
bors added a commit that referenced this issue Feb 26, 2016
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
@alexcrichton
Copy link
Member

Ah this was implemented in #2398, yay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants