connect: fix two CA tests that were broken in a previous PR (#60)
This commit is contained in:
parent
a8d3131de9
commit
549dc22944
|
@ -85,7 +85,7 @@ func fixupConfig(conf *structs.CAConfiguration) {
|
||||||
conf.Config[k] = ca.Uint8ToString(raw)
|
conf.Config[k] = ca.Uint8ToString(raw)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if conf.Config["PrivateKey"] != "" {
|
if v, ok := conf.Config["PrivateKey"]; ok && v != "" {
|
||||||
conf.Config["PrivateKey"] = "hidden"
|
conf.Config["PrivateKey"] = "hidden"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,19 @@ type ConsulCAProviderConfig struct {
|
||||||
// ConsulCAProviderConfig.
|
// ConsulCAProviderConfig.
|
||||||
func ParseConsulCAConfig(raw map[string]interface{}) (*ConsulCAProviderConfig, error) {
|
func ParseConsulCAConfig(raw map[string]interface{}) (*ConsulCAProviderConfig, error) {
|
||||||
var config ConsulCAProviderConfig
|
var config ConsulCAProviderConfig
|
||||||
if err := mapstructure.WeakDecode(raw, &config); err != nil {
|
decodeConf := &mapstructure.DecoderConfig{
|
||||||
|
DecodeHook: mapstructure.StringToTimeDurationHookFunc(),
|
||||||
|
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