Enh Req: Introduce Config metadata for troubleshoot of override/layered values
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 3.2k
- Forks
- 265
- Avg merge
- 2h 42m
- Merged PRs (30d)
- 4
Description
Hi, in many situations when multiple sources of configurations are used - it's beneficial to have ability of Config metadata to tell which value came from which source and became effective/actual at the end of sources processing.
Implementation of this could add extra feature, for example "config-meta" and once used/enabled - later have method like "get_meta" or "dump_meta".
So if let say I have something like such for config construction out of 2 sources:
fn make_config() -> Config {
let current_env = env::var("ENV").unwrap();
Config::builder()
.add_source(File::new("env/service", FileFormat::Yaml))
.add_source(File::new(("env/service-".to_string() + ¤t_env).as_str(), FileFormat::Yaml))
.build()
.unwrap()
}
and let say one of my YAMLs has such:
debug: false
and another:
debug: true
then that new method "dump_meta" could print something like this:
debug: false <= taken from service.yml
debug: true <= taken as override from service-dev.yml and effective
As I'm yet new to Rust - this is just proposal at this point from my side, which I could try to implement one day if no volunteers.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading Config::builder and the add_source processing flow described in the issue. Determine how layered values could retain their source information, then define and document a config-meta capability such as get_meta or dump_meta that reports each value's source and which value is effective after overrides.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100