1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-05 01:57:20 +00:00

Added option to disable web hooks

This mod introduces DISABLE_WEB_HOOKS parameter in [security] section
of app.ini (by default set to false). If set to true it disables web
hooks feature. Any existing undelivered web hook tasks will be cancelled.
Any existing web hook definitions will be left untouched in db but
its delivery tasks will be ignored.

Author-Change-Id: IB#1105130
This commit is contained in:
Pawel Boguslawski
2020-10-16 16:51:45 +02:00
parent b222dbc1d1
commit 07df6614dc
12 changed files with 62 additions and 19 deletions

View File

@ -68,6 +68,11 @@ func checkBranch(w *models.Webhook, branch string) bool {
}
func prepareWebhook(w *models.Webhook, repo *models.Repository, event models.HookEventType, p api.Payloader) error {
// Skip sending if web hooks are disabled.
if setting.DisableWebHooks {
return nil
}
for _, e := range w.EventCheckers() {
if event == e.Type {
if !e.Has() {