in utils/hints.go [158:178]
func GetHintAsConfigs(hints mapstr.M, key string) []mapstr.M {
if str := GetHintString(hints, key, "raw"); str != "" {
// check if it is a single config
if str[0] != '[' {
cfg := mapstr.M{}
if err := json.Unmarshal([]byte(str), &cfg); err != nil {
logp.NewLogger(logName).Debugw("Unable to unmarshal json due to error", "error", err)
return nil
}
return []mapstr.M{cfg}
}
var cfg []mapstr.M
if err := json.Unmarshal([]byte(str), &cfg); err != nil {
logp.NewLogger(logName).Debugw("Unable to unmarshal json due to error", "error", err)
return nil
}
return cfg
}
return nil
}