summaryrefslogtreecommitdiffstats
path: root/src/go/collectors/go.d.plugin/modules/apache/init.go
blob: 00fc9d7e6f83b9649d3d1560c8b8a0d6a6eaa7e0 (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
// SPDX-License-Identifier: GPL-3.0-or-later

package apache

import (
	"errors"
	"net/http"
	"strings"

	"github.com/netdata/netdata/go/go.d.plugin/pkg/web"
)

func (a *Apache) validateConfig() error {
	if a.URL == "" {
		return errors.New("url not set")
	}
	if !strings.HasSuffix(a.URL, "?auto") {
		return errors.New("invalid URL, should ends in '?auto'")
	}
	return nil
}

func (a *Apache) initHTTPClient() (*http.Client, error) {
	return web.NewHTTPClient(a.Client)
}