Is it possible in .yml
config to have dynamic properties in variables that are set depending on a particular case. For example:
MY_VAR: &MY_VAR
YAML's anchors (&MY_VAR
) and references (*MY_VAR
) are in the specification to prevent duplication, but also to allow serialisation of objects that occur multiple times in a hierarchy, and to allow them to be deserialized so that they again point to the same structure in memory.
This is not some string level macro facility with parameters and/or conditions. In your example, if you set MY_VAR->key1
you also change the value of section1->var->key1
Of course an application can interpret the values it loads (e.g. on complex strings that form scalar for the key in a mapping), but for that there is no facility in the YAML specification. That has to be (and can be) done at the application level.