Closed jhalterman closed 7 years ago
Hi @jhalterman, sorry for the late reply. This is not supported because the yaml config reader (Symfony Yaml component) takes the last value of the key and overwrites the old one. The specification writes:
JSON's RFC4627 requires that mappings keys merely “SHOULD” be unique, while YAML insists they “MUST” be. Technically, YAML therefore complies with the JSON spec, choosing to treat duplicates as an error. In practice, since JSON is silent on the semantics of such duplicates, the only portable JSON files are those with unique keys, which are therefore valid YAML files.
Personally I'd prefer to use different files for different environments,
I'm wondering if you'd consider adding support for merging duplicate keys in a config file. My use case for this is wanting to have multiple environment config sections in a file since it makes config easier to organize by functionality. Example:
Ideally, this would be merged when loaded to:
While I could just write my config fully merged by environment, with a lot of config and multiple environments it's easier to maintain when it's organized by functionality.