mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-24 16:47:47 +00:00
aa2a1848da
* feat: add filesystem and stdout notification channels * configure through env vars * compile * feat: add compact option for debug notification channels * fix channel mock generation * avoid sensitive information in error message Co-authored-by: Livio Amstutz <livio.a@gmail.com> * add review improvements Co-authored-by: Livio Amstutz <livio.a@gmail.com>
25 lines
667 B
Go
25 lines
667 B
Go
package senders
|
|
|
|
import "github.com/caos/zitadel/internal/notification/channels"
|
|
|
|
var _ channels.NotificationChannel = (*Chain)(nil)
|
|
|
|
type Chain struct {
|
|
channels []channels.NotificationChannel
|
|
}
|
|
|
|
func chainChannels(channel ...channels.NotificationChannel) *Chain {
|
|
return &Chain{channels: channel}
|
|
}
|
|
|
|
// HandleMessage returns a non nil error from a provider immediately if any occurs
|
|
// messages are sent to channels in the same order they were provided to chainChannels()
|
|
func (c *Chain) HandleMessage(message channels.Message) error {
|
|
for i := range c.channels {
|
|
if err := c.channels[i].HandleMessage(message); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|