aboutsummaryrefslogtreecommitdiff
path: root/modules/setting/setting.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-02-21 20:21:25 -0500
committerUnknwon <u@gogs.io>2017-02-21 20:21:25 -0500
commit60aca9ea18f4fed6c98c83d41036f9a34fdbd28c (patch)
tree5fbf8009c9997678e4d9dedde80d98fd1e489cc8 /modules/setting/setting.go
parent6a8ad0b3574c3ab1f3a441493dc002b805b45a38 (diff)
webhook: also only enable certain types (#3356)
Add new config option '[webhook] TYPES’.
Diffstat (limited to 'modules/setting/setting.go')
-rw-r--r--modules/setting/setting.go30
1 files changed, 11 insertions, 19 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index f0960aef..7652e0eb 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -107,15 +107,6 @@ var (
UsePostgreSQL bool
UseMSSQL bool
- // Webhook settings
- Webhook struct {
- QueueLength int
- DeliverTimeout int
- SkipTLSVerify bool
- Types []string
- PagingNum int
- }
-
// Repository settings
Repository struct {
AnsiCharset string
@@ -146,6 +137,15 @@ var (
RepoRootPath string
ScriptType string
+ // Webhook settings
+ Webhook struct {
+ Types []string
+ QueueLength int
+ DeliverTimeout int
+ SkipTLSVerify bool
+ PagingNum int
+ }
+
// Markdown sttings
Markdown struct {
EnableHardLineBreak bool
@@ -579,6 +579,8 @@ func NewContext() {
if err = Cfg.Section("http").MapTo(&HTTP); err != nil {
log.Fatal(2, "Fail to map HTTP settings: %v", err)
+ } else if err = Cfg.Section("webhook").MapTo(&Webhook); err != nil {
+ log.Fatal(2, "Fail to map Webhook settings: %v", err)
} else if err = Cfg.Section("markdown").MapTo(&Markdown); err != nil {
log.Fatal(2, "Fail to map Markdown settings: %v", err)
} else if err = Cfg.Section("admin").MapTo(&Admin); err != nil {
@@ -822,15 +824,6 @@ func newNotifyMailService() {
log.Info("Notify Mail Service Enabled")
}
-func newWebhookService() {
- sec := Cfg.Section("webhook")
- Webhook.QueueLength = sec.Key("QUEUE_LENGTH").MustInt(1000)
- Webhook.DeliverTimeout = sec.Key("DELIVER_TIMEOUT").MustInt(5)
- Webhook.SkipTLSVerify = sec.Key("SKIP_TLS_VERIFY").MustBool()
- Webhook.Types = []string{"gogs", "slack", "discord"}
- Webhook.PagingNum = sec.Key("PAGING_NUM").MustInt(10)
-}
-
func NewService() {
newService()
}
@@ -843,5 +836,4 @@ func NewServices() {
newMailService()
newRegisterMailService()
newNotifyMailService()
- newWebhookService()
}