blob: 0923262c35d73cbcb977fd3b86a137f4dc3dc24d (
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 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
}
|