Finish implementing cargo config
and related support · Issue #2362 · rust-lang/cargo (original) (raw)
Configuration in Cargo initially had a relatively grand vision, but much of it was unfortunately never implemented. This issue should help track finishing this support as well as explaining what it is intended to be!
A cargo config
subcommand
It was initially intended to have a cargo config
subcommand ala git config
or bundle config
. Configuration values could be read/written through this interface to the various locations on the system as need be.
An example of this would be Bundler's bundle config command.
The major blocker for this is being able to read a TOML file, modify some aspects of it, and then write it back to the filesystem. This should crucially preserve aspects such as comments, formatting, etc. Today we cannot do this.
Environment variables for configuration
Right now we've got a smattering of environment variables, but it's somewhat inconsistent in terms of what's an environment variables, what's a command line option, and what's a configuration option.
I believe it was originally intended that environment variables and configuration options should be one-and-the-same. All configuration options should have a mapping to an environment variable which provides the ability to read/write that field. For example Bundler has this as well.