Skip to content

Commit c772844

Browse files
committed
add docs form webhook types
1 parent 636ced9 commit c772844

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

custom/conf/app.ini.sample

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,8 @@ AUTO_WATCH_NEW_REPOS = true
508508
AUTO_WATCH_ON_CHANGES = false
509509

510510
[webhook]
511+
; Supported webhook types
512+
SUPPORTED_TYPES = gitea, gogs, slack, discord, dingtalk, telegram, msteams
511513
; Hook task queue length, increase if webhook shooting starts hanging
512514
QUEUE_LENGTH = 1000
513515
; Deliver timeout in seconds

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ relation to port exhaustion.
311311

312312
## Webhook (`webhook`)
313313

314+
- `SUPPORTED_TYPES`: **gitea, gogs, slack, discord, dingtalk, telegram, msteams** Supported webhook types.
314315
- `QUEUE_LENGTH`: **1000**: Hook task queue length. Use caution when editing this value.
315316
- `DELIVER_TIMEOUT`: **5**: Delivery timeout (sec) for shooting webhooks.
316317
- `SKIP_TLS_VERIFY`: **false**: Allow insecure certification.

docs/content/doc/advanced/config-cheat-sheet.zh-cn.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ menu:
125125

126126
## Webhook (`webhook`)
127127

128+
- `SUPPORTED_TYPES`: **gitea, gogs, slack, discord, dingtalk, telegram, msteams** 支持的 webhook 类型。
128129
- `QUEUE_LENGTH`: 说明: Hook 任务队列长度。
129130
- `DELIVER_TIMEOUT`: 请求webhooks的超时时间,单位秒。
130131
- `SKIP_TLS_VERIFY`: 是否允许不安全的证书。

modules/setting/webhook.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var (
2525
QueueLength: 1000,
2626
DeliverTimeout: 5,
2727
SkipTLSVerify: false,
28+
Types: []string{"gitea", "gogs", "slack", "discord", "dingtalk", "telegram", "msteams"},
2829
PagingNum: 10,
2930
ProxyURL: "",
3031
ProxyHosts: []string{},
@@ -33,10 +34,15 @@ var (
3334

3435
func newWebhookService() {
3536
sec := Cfg.Section("webhook")
37+
3638
Webhook.QueueLength = sec.Key("QUEUE_LENGTH").MustInt(1000)
3739
Webhook.DeliverTimeout = sec.Key("DELIVER_TIMEOUT").MustInt(5)
3840
Webhook.SkipTLSVerify = sec.Key("SKIP_TLS_VERIFY").MustBool()
39-
Webhook.Types = []string{"gitea", "gogs", "slack", "discord", "dingtalk", "telegram", "msteams"}
41+
defaults := Webhook.Types
42+
Webhook.Types = sec.Key("SUPPORTED_TYPES").Strings(",")
43+
if len(Webhook.Types) == 0 {
44+
Webhook.Types = defaults
45+
}
4046
Webhook.PagingNum = sec.Key("PAGING_NUM").MustInt(10)
4147
Webhook.ProxyURL = sec.Key("PROXY_URL").MustString("")
4248
if Webhook.ProxyURL != "" {

0 commit comments

Comments
 (0)