-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Want env var specifying overriding config file #6728
Copy link
Copy link
Closed as not planned
Labels
A-configurationArea: cargo config files and env varsArea: cargo config files and env varsC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-infoStatus: Needs more info, such as a reproduction or more background for a feature request.Status: Needs more info, such as a reproduction or more background for a feature request.
Metadata
Metadata
Assignees
Labels
A-configurationArea: cargo config files and env varsArea: cargo config files and env varsC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-infoStatus: Needs more info, such as a reproduction or more background for a feature request.Status: Needs more info, such as a reproduction or more background for a feature request.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Problem
I have a situation where I have a
.cargo/configwhich is nearly always right, and which I definitely very firmly want to be the default, but I need to be able to occasionally override it.Because cargo simply searches up the directory tree there is no easy way to do this right now. I could override the config settings using env vars, but since some of the settings are tables that is no good.
Proposed solution
There should be an environment variable
CARGO_CONFIG_INCLUDEwhich contains a:-separated list of TOML files. These should be read after all the.cargo/configfiles but processed before the command line, so that it overrides config files but is in turn overridden by the command line.On Windows the list should be split (only) on
;. For the benefit of Windows, to make it possible to be compatible with both Unix and Windows, on Unix the list should be split on;as well as:. As a result on Unix:and;in filenames would be inexpressible; likewise;in filenames on Windows. This is the traditional approach to path-like variables.