mehcode / config-rs

⚙️ Layered configuration system for Rust applications (with strong support for 12-factor applications).
Apache License 2.0
2.43k stars 206 forks source link

Vector fields are overwritten instead of merged #435

Open dhruvkb opened 1 year ago

dhruvkb commented 1 year ago

Consider the following config.

struct Conf {
    nums: Vec<i32>
}

This is built and given two config files.

# a.yml
nums:
- 1
- 2
# b.yml
nums:
- 3
- 4

The output of this configuration is that nums has only [3, 4]. Vectors should be merged, and nums should contain [1, 2, 3, 4].

matthiasbeyer commented 1 year ago

Hi,

thanks for your report. I don't think lists should be merged necessarily, but I see that in some instances, users might want to merge lists.

dhruvkb commented 1 year ago

If not the predominant default behaviour, at least an option or workaround to merge lists would be great to have. Thanks for considering this.