summaryrefslogtreecommitdiffstats
path: root/src/go/plugin/go.d/modules/beanstalk/init.go
blob: 50916b3a77a2479fc6ecb0c7a9dd691f38cfcaf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// SPDX-License-Identifier: GPL-3.0-or-later

package beanstalk

import (
	"errors"

	"github.com/netdata/netdata/go/plugins/plugin/go.d/pkg/matcher"
)

func (b *Beanstalk) validateConfig() error {
	if b.Address == "" {
		return errors.New("beanstalk address is required")
	}
	return nil
}

func (b *Beanstalk) initTubeSelector() (matcher.Matcher, error) {
	if b.TubeSelector == "" {
		return matcher.TRUE(), nil
	}

	m, err := matcher.NewSimplePatternsMatcher(b.TubeSelector)
	if err != nil {
		return nil, err
	}

	return m, nil
}