in out_writeapi.go [254:276]
func getConfigField[T int | bool](plugin unsafe.Pointer, key string, defaultval T) (T, error) {
currstr := output.FLBPluginConfigKey(plugin, key)
finval := defaultval
if currstr != "" {
switch any(defaultval).(type) {
case int:
intval, err := strconv.Atoi(currstr)
if err != nil {
return defaultval, err
} else {
finval = any(intval).(T)
}
case bool:
boolval, err := strconv.ParseBool(currstr)
if err != nil {
return defaultval, err
} else {
finval = any(boolval).(T)
}
}
}
return finval, nil
}