-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Cargo doesn't uniformly read configuration from env vars #5416
Copy link
Copy link
Open
Labels
A-configurationArea: cargo config files and env varsArea: cargo config files and env varsA-environment-variablesArea: environment variablesArea: environment variablesC-bugCategory: bugCategory: bugS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Z-advanced-envNightly: advanced-envNightly: advanced-env
Metadata
Metadata
Assignees
Labels
A-configurationArea: cargo config files and env varsArea: cargo config files and env varsA-environment-variablesArea: environment variablesArea: environment variablesC-bugCategory: bugCategory: bugS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Z-advanced-envNightly: advanced-envNightly: advanced-env
Type
Fields
Give feedbackNo fields configured for issues without a type.
View all comments
Most configuration read through cargo uses helpers like
Config::get_stringwhich automatically read env vars, but configuration reading portions of Cargo that go throughConfig::get_tabledo not read environment variables. The return value here is aHashMapwhich doesn't proxy reads to an environment variable.This affects, for example, source replacement. Source replacement is not configurable through environment variables (a bug) because of its use of
get_table.We should tackle this via one of two routes:
get_tableentirely. Just don't expose the ability to read a table and force all configuration reads to go throughget_stringand friends. This may or may not be uniformly possible as IIRC there's portions of Cargo that rely oniterwhich is a bit of a bummer.get_tableto return a wrapper rather than aHashMap. Reads of theHashMapwould "do the right thing" with environment variables. Again though it's not clear how such a wrapper would implementiteras well...In any case, some questions to still work through here!