mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-05 16:59:35 +00:00
4b4aeff24b
templates/swagger/v1_json.tmpl updated with `make generate-swagger` (cherry picked from commit88899c492e
) (cherry picked from commit7171bd9617
) (cherry picked from commit1a742446c1
) (cherry picked from commit132342ae8d
) (cherry picked from commitb47b815fbe
) (cherry picked from commit2dbb52c8ec
) (cherry picked from commitc846de4322
) (cherry picked from commitc3d1ad7bbc
) (cherry picked from commit972c772c0e
)
50 lines
1.4 KiB
Go
50 lines
1.4 KiB
Go
// Copyright 2019 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package setting
|
|
|
|
import (
|
|
"net/url"
|
|
|
|
"code.gitea.io/gitea/modules/log"
|
|
)
|
|
|
|
// Webhook settings
|
|
var Webhook = struct {
|
|
QueueLength int
|
|
DeliverTimeout int
|
|
SkipTLSVerify bool
|
|
AllowedHostList string
|
|
Types []string
|
|
PagingNum int
|
|
ProxyURL string
|
|
ProxyURLFixed *url.URL
|
|
ProxyHosts []string
|
|
}{
|
|
QueueLength: 1000,
|
|
DeliverTimeout: 5,
|
|
SkipTLSVerify: false,
|
|
PagingNum: 10,
|
|
ProxyURL: "",
|
|
ProxyHosts: []string{},
|
|
}
|
|
|
|
func loadWebhookFrom(rootCfg ConfigProvider) {
|
|
sec := rootCfg.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.AllowedHostList = sec.Key("ALLOWED_HOST_LIST").MustString("")
|
|
Webhook.Types = []string{"forgejo", "gitea", "gogs", "slack", "discord", "dingtalk", "telegram", "msteams", "feishu", "matrix", "wechatwork", "packagist"}
|
|
Webhook.PagingNum = sec.Key("PAGING_NUM").MustInt(10)
|
|
Webhook.ProxyURL = sec.Key("PROXY_URL").MustString("")
|
|
if Webhook.ProxyURL != "" {
|
|
var err error
|
|
Webhook.ProxyURLFixed, err = url.Parse(Webhook.ProxyURL)
|
|
if err != nil {
|
|
log.Error("Webhook PROXY_URL is not valid")
|
|
Webhook.ProxyURL = ""
|
|
}
|
|
}
|
|
Webhook.ProxyHosts = sec.Key("PROXY_HOSTS").Strings(",")
|
|
}
|