瀏覽代碼

Enable poller

Brendan Abolivier 6 年之前
父節點
當前提交
c264f267df
簽署人: Brendan Abolivier <contact@brendanabolivier.com> GPG 金鑰 ID: 8EF1500759F70623
共有 1 個檔案被更改,包括 10 行新增1 行删除
  1. 10
    1
      src/pusher/main.go

+ 10
- 1
src/pusher/main.go 查看文件

@@ -6,6 +6,7 @@ import (
6 6
 	"config"
7 7
 	"grafana"
8 8
 	"logger"
9
+	"pusher/poller"
9 10
 	"pusher/webhook"
10 11
 
11 12
 	"github.com/sirupsen/logrus"
@@ -30,7 +31,15 @@ func main() {
30 31
 
31 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 43
 		logrus.Panic(err)
35 44
 	}
36 45
 }