mirror of https://github.com/hashicorp/consul
connect/ca: use weak type decoding in the Vault config parsing
parent
b4ef7bb64d
commit
8c2c9705d9
|
@ -285,7 +285,18 @@ func (v *VaultProvider) Cleanup() error {
|
||||||
func ParseVaultCAConfig(raw map[string]interface{}) (*structs.VaultCAProviderConfig, error) {
|
func ParseVaultCAConfig(raw map[string]interface{}) (*structs.VaultCAProviderConfig, error) {
|
||||||
var config structs.VaultCAProviderConfig
|
var config structs.VaultCAProviderConfig
|
||||||
|
|
||||||
if err := mapstructure.Decode(raw, &config); err != nil {
|
decodeConf := &mapstructure.DecoderConfig{
|
||||||
|
ErrorUnused: true,
|
||||||
|
Result: &config,
|
||||||
|
WeaklyTypedInput: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
decoder, err := mapstructure.NewDecoder(decodeConf)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := decoder.Decode(raw); err != nil {
|
||||||
return nil, fmt.Errorf("error decoding config: %s", err)
|
return nil, fmt.Errorf("error decoding config: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue