Implement support for config includes/imports #893
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds support for inheriting/importing/including configuration
files by specifying a config key which, when encountered, is to be
treated as a list of config files to inherit from and be merged with the
source config file, establishing a config hierarchy.
This allows developers to have e.g., a "base" configuration which
is then imported by their "beta" config or "production" config to
be overridden or extended.
As an example, one can call
SetConfigIncludeKey("includes")
and theninclude config files in their e.g., YAML config as follows:
which will search for
base.yaml
in the specified config paths, read it, and merge the current config into it.Naturally, this only works on local config files and is implemented
with that restriction in mind. Moreover, writing out the loaded config
should correctly output the final merged config, sans the specified
config include key (since it wouldn't be of much use).
All existing tests pass and new tests were added for this feature.