mirror of https://github.com/status-im/consul.git
connect: fix two CA tests that were broken in a previous PR (#60)
This commit is contained in:
parent
01fefd3d92
commit
82a4b3c13f
|
@ -85,7 +85,7 @@ func fixupConfig(conf *structs.CAConfiguration) {
|
|||
conf.Config[k] = ca.Uint8ToString(raw)
|
||||
}
|
||||
}
|
||||
if conf.Config["PrivateKey"] != "" {
|
||||
if v, ok := conf.Config["PrivateKey"]; ok && v != "" {
|
||||
conf.Config["PrivateKey"] = "hidden"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,19 @@ type ConsulCAProviderConfig struct {
|
|||
// ConsulCAProviderConfig.
|
||||
func ParseConsulCAConfig(raw map[string]interface{}) (*ConsulCAProviderConfig, error) {
|
||||
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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue