From d1d9d8a712d89a3ac3dbf3471c88ec59c0883ecd Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Fri, 8 May 2020 17:08:40 -0400 Subject: [PATCH] Add decode hooks to other parse functions Now that the original config parsing leaves the opaque maps unmodified these secondary decodes must use the hooks to normalize fields. --- agent/structs/connect_proxy_config.go | 2 -- agent/xds/config.go | 1 - 2 files changed, 3 deletions(-) diff --git a/agent/structs/connect_proxy_config.go b/agent/structs/connect_proxy_config.go index 491e4e0297f1..2112a681c0af 100644 --- a/agent/structs/connect_proxy_config.go +++ b/agent/structs/connect_proxy_config.go @@ -426,8 +426,6 @@ type ExposePath struct { ParsedFromCheck bool } -// TODO: this is most likely not used. The API type is the one to be deserialized -// with JSON func (t *ExposePath) UnmarshalJSON(data []byte) (err error) { type Alias ExposePath aux := &struct { diff --git a/agent/xds/config.go b/agent/xds/config.go index d4e8090b43ff..e1918491825f 100644 --- a/agent/xds/config.go +++ b/agent/xds/config.go @@ -58,7 +58,6 @@ type ProxyConfig struct { // allows caller to choose whether and how to report the error. func ParseProxyConfig(m map[string]interface{}) (ProxyConfig, error) { var cfg ProxyConfig - err := mapstructure.WeakDecode(m, &cfg) decodeConf := &mapstructure.DecoderConfig{ DecodeHook: mapstructure.ComposeDecodeHookFunc( decode.HookWeakDecodeFromSlice,