|
@@ -19,18 +19,25 @@ var (
|
19
|
19
|
func main() {
|
20
|
20
|
var err error
|
21
|
21
|
|
|
22
|
+ // Define this flag in the main function because else it would cause a
|
|
23
|
+ // conflict with the one in the puller.
|
22
|
24
|
configFile := flag.String("config", "config.yaml", "Path to the configuration file")
|
23
|
25
|
flag.Parse()
|
24
|
26
|
|
|
27
|
+ // Load the logger's configuration.
|
25
|
28
|
logger.LogConfig()
|
26
|
29
|
|
|
30
|
+ // Load the configuration.
|
27
|
31
|
cfg, err := config.Load(*configFile)
|
28
|
32
|
if err != nil {
|
29
|
33
|
logrus.Panic(err)
|
30
|
34
|
}
|
31
|
35
|
|
|
36
|
+ // Initialise the Grafana API client.
|
32
|
37
|
grafanaClient := grafana.NewClient(cfg.Grafana.BaseURL, cfg.Grafana.APIKey)
|
33
|
38
|
|
|
39
|
+ // Set up either a webhook or a poller depending on the mode specified in the
|
|
40
|
+ // configuration file.
|
34
|
41
|
switch cfg.Pusher.Mode {
|
35
|
42
|
case "webhook":
|
36
|
43
|
err = webhook.Setup(cfg, grafanaClient, *deleteRemoved)
|