open-consul/command/config
Daniel Nephin 7b99d9a25d config: add HookWeakDecodeFromSlice
Currently opaque config blocks (config entries, and CA provider config) are
modified by PatchSliceOfMaps, making it impossible for these opaque
config sections to contain slices of maps.

In order to fix this problem, any lazy-decoding of these blocks needs to support
weak decoding of []map[string]interface{} to a struct type before
PatchSliceOfMaps is replaces. This is necessary because these config
blobs are persisted, and during an upgrade an older version of Consul
could read one of the new configuration values, which would cause an error.

To support the upgrade path, this commit first introduces the new hooks
for weak decoding of []map[string]interface{} and uses them only in the
lazy-decode paths. That way, in a future release, new style
configuration will be supported by the older version of Consul.

This decode hook has a number of advantages:

1. It no longer panics. It allows mapstructure to report the error
2. It no longer requires the user to declare which fields are slices of
   structs. It can deduce that information from the 'to' value.
3. It will make it possible to preserve opaque configuration, allowing
   for structured opaque config.
2020-06-08 17:05:09 -04:00
..
delete Remove name from NewTestAgent 2020-03-31 16:13:44 -04:00
list Remove name from NewTestAgent 2020-03-31 16:13:44 -04:00
read Remove name from NewTestAgent 2020-03-31 16:13:44 -04:00
write config: add HookWeakDecodeFromSlice 2020-06-08 17:05:09 -04:00
config.go adding new config entries for L7 discovery chain (unused) (#5987) 2019-06-27 12:37:43 -05:00