Add webhooks

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2026-02-11 09:34:06 +01:00
parent 4945c022a1
commit f9de9c4834
34 changed files with 5932 additions and 4 deletions

View File

@@ -60,6 +60,7 @@ import (
"go.probo.inc/probo/pkg/server"
"go.probo.inc/probo/pkg/slack"
"go.probo.inc/probo/pkg/trust"
"go.probo.inc/probo/pkg/webhook"
"golang.org/x/sync/errgroup"
)
@@ -154,6 +155,9 @@ func New() *Implm {
Slack: slackConfig{
SenderInterval: 60,
},
Webhook: webhookConfig{
SenderInterval: 5,
},
},
CustomDomains: customDomainsConfig{
RenewalInterval: 3600,
@@ -479,6 +483,19 @@ func (impl *Implm) Run(
},
)
webhookSenderCtx, stopWebhookSender := context.WithCancel(context.Background())
webhookSender := webhook.NewSender(pgClient, l.Named("webhook-sender"), webhook.Config{
Interval: time.Duration(impl.cfg.Notifications.Webhook.SenderInterval) * time.Second,
EncryptionKey: impl.cfg.EncryptionKey,
})
wg.Go(
func() {
if err := webhookSender.Run(webhookSenderCtx); err != nil {
cancel(fmt.Errorf("webhook sender crashed: %w", err))
}
},
)
exportJobExporterCtx, stopExportJobExporter := context.WithCancel(context.Background())
wg.Go(
func() {
@@ -511,6 +528,7 @@ func (impl *Implm) Run(
stopMailer()
stopSlackSender()
stopWebhookSender()
stopExportJobExporter()
stopIAMService()
stopApiServer()