You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Found this debugging elastic/beats#16190. Seems that when two configuration objects are merged that arrays that contain maps are merged incorrectly. Instead of appending the second config array item after the first item from the first config, it merges the maps. This creates an array length of 1 with the maps merged together.
Wrote a quick unit test to show the issue below (test fails):
By default go-ucfg tries to treat all settings like the setting names have been flattened. In the example given we have the settings in config 1:
processors.0.add_locale: {}
and in config 2:
processors.0.add_fields.foo: bar
When merging these two configurations we have:
processors.0.add_locale: {}
processors.0.add_fields.foo: bar
Now when we dedot we get:
processors:
- add_locale: {}
add_fields.foo: bar
By default when merging arrays are not appended, but merged like any other objects. A Config object in go-ucfg acts like a 'table' and arrays are treated like normal objects.
One can modify the behavior "globally" by passing one of these options to Merge: "ReplaceValues", "AppendValues", or "PrependValues". Go structs can overwrite array merging for a field (and it's children) by setting the struct-tag options: "merge", "replace", "append", "prepend".
Found this debugging elastic/beats#16190. Seems that when two configuration objects are merged that arrays that contain maps are merged incorrectly. Instead of appending the second config array item after the first item from the first config, it merges the maps. This creates an array length of 1 with the maps merged together.
Wrote a quick unit test to show the issue below (test fails):
The text was updated successfully, but these errors were encountered: