in lib/notifiers/notifiers.go [566:585]
func GetSecretRef(config map[string]interface{}, fieldName string) (string, error) {
field, ok := config[fieldName]
if !ok {
return "", fmt.Errorf("field name %q not present in notification config %v", fieldName, config)
}
m, ok := field.(map[interface{}]interface{})
if !ok {
return "", fmt.Errorf("expected secret field %q to be a map[interface{}]interface{} object", fieldName)
}
ref, ok := m[secretRef]
if !ok {
return "", fmt.Errorf("expected field %q to be of the form `secretRef: <some-ref>`", fieldName)
}
sRef, ok := ref.(string)
if !ok {
return "", fmt.Errorf("expected field %q of parent %q to have a string value", secretRef, fieldName)
}
return sRef, nil
}