diff options
Diffstat (limited to '')
-rw-r--r-- | src/go/plugin/go.d/modules/lighttpd/init.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/go/plugin/go.d/modules/lighttpd/init.go b/src/go/plugin/go.d/modules/lighttpd/init.go new file mode 100644 index 000000000..0923262c3 --- /dev/null +++ b/src/go/plugin/go.d/modules/lighttpd/init.go @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package lighttpd + +import ( + "errors" + "fmt" + "strings" + + "github.com/netdata/netdata/go/plugins/plugin/go.d/pkg/web" +) + +func (l *Lighttpd) validateConfig() error { + if l.URL == "" { + return errors.New("url not set") + } + if !strings.HasSuffix(l.URL, "?auto") { + return fmt.Errorf("bad URL '%s', should ends in '?auto'", l.URL) + } + return nil +} + +func (l *Lighttpd) initApiClient() (*apiClient, error) { + client, err := web.NewHTTPClient(l.Client) + if err != nil { + return nil, err + } + return newAPIClient(client, l.Request), nil +} |