Skip to content

Commit

Permalink
Plugins: add watchdog bool setter
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Jul 3, 2024
1 parent a34e7ae commit cb086f8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions provider/watchdog.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,23 @@ func (o *watchdogProvider) FloatSetter(param string) (func(float64) error, error

return setter(o, set, reset), nil
}

var _ SetBoolProvider = (*watchdogProvider)(nil)

func (o *watchdogProvider) BoolSetter(param string) (func(bool) error, error) {
set, err := NewBoolSetterFromConfig(param, o.set)
if err != nil {
return nil, err
}

var reset *bool
if o.reset != nil {
val, err := strconv.ParseBool(*o.reset)
if err != nil {
return nil, err
}
reset = &val
}

return setter(o, set, reset), nil
}

0 comments on commit cb086f8

Please sign in to comment.