feat: add wecom notifier

This commit is contained in:
Fu Diwei
2024-12-22 11:25:08 +08:00
parent a1fec5f6ac
commit 01d30bb742
14 changed files with 235 additions and 39 deletions

View File

@@ -12,6 +12,7 @@ import (
providerServerChan "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/serverchan"
providerTelegram "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/telegram"
providerWebhook "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/webhook"
providerWeCom "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/wecom"
"github.com/usual2970/certimate/internal/pkg/utils/maps"
)
@@ -64,6 +65,11 @@ func createNotifier(channel string, channelConfig map[string]any) (notifier.Noti
return providerWebhook.New(&providerWebhook.WebhookNotifierConfig{
Url: maps.GetValueAsString(channelConfig, "url"),
})
case domain.NotifyChannelWeCom:
return providerWeCom.New(&providerWeCom.WeComNotifierConfig{
WebhookUrl: maps.GetValueAsString(channelConfig, "webhookUrl"),
})
}
return nil, fmt.Errorf("unsupported notifier channel: %s", channelConfig)