Explorar el Código

Enable poller

Brendan Abolivier hace 6 años
padre
commit
c264f267df
Firmado por: Brendan Abolivier <contact@brendanabolivier.com> ID clave GPG: 8EF1500759F70623
Se han modificado 1 ficheros con 10 adiciones y 1 borrados
  1. 10
    1
      src/pusher/main.go

+ 10
- 1
src/pusher/main.go Ver fichero

6
 	"config"
6
 	"config"
7
 	"grafana"
7
 	"grafana"
8
 	"logger"
8
 	"logger"
9
+	"pusher/poller"
9
 	"pusher/webhook"
10
 	"pusher/webhook"
10
 
11
 
11
 	"github.com/sirupsen/logrus"
12
 	"github.com/sirupsen/logrus"
30
 
31
 
31
 	grafanaClient := grafana.NewClient(cfg.Grafana.BaseURL, cfg.Grafana.APIKey)
32
 	grafanaClient := grafana.NewClient(cfg.Grafana.BaseURL, cfg.Grafana.APIKey)
32
 
33
 
33
-	if err = webhook.Setup(cfg, grafanaClient, *deleteRemoved); err != nil {
34
+	switch cfg.Pusher.Mode {
35
+	case "webhook":
36
+		err = webhook.Setup(cfg, grafanaClient, *deleteRemoved)
37
+		break
38
+	case "git-pull":
39
+		err = poller.Setup(cfg, grafanaClient, *deleteRemoved)
40
+	}
41
+
42
+	if err != nil {
34
 		logrus.Panic(err)
43
 		logrus.Panic(err)
35
 	}
44
 	}
36
 }
45
 }