func GetGlobalWebHooks(c *gin.Context) { hooks, err := models.GetGlobalWebHooks(nil) if err != nil { Error(c, SERVER_ERROR, err.Error()) return } Success(c, hooks) }
func TriggerWebHooks(m *models.ConfigUpdateHistory, app *models.App) { var globalHooks, appHooks []*models.WebHook globalHooks, _ = models.GetGlobalWebHooks(nil) appHooks, _ = models.GetWebHooksByAppKey(nil, app.Key) for _, hook := range append(globalHooks, appHooks...) { switch hook.Target { case models.WEBHOOK_TARGET_PUBU: sendNotificationToPubu(hook.URL, m, app) case models.WEBHOOK_TARGET_SLACK: sendNotificationToSlack(hook.URL, m, app) } } }