feat: enable default smtp config on setup (#3622)

* feat: enable default smtp config on setup

* fix tests

* fix channel order

Co-authored-by: Fabi <38692350+fgerschwiler@users.noreply.github.com>
This commit is contained in:
Livio Amstutz
2022-05-13 14:13:07 +02:00
committed by GitHub
parent 5571db3e1b
commit 024eedc1b5
15 changed files with 261 additions and 159 deletions

View File

@@ -3,18 +3,17 @@ package senders
import (
"context"
"github.com/zitadel/zitadel/internal/notification/channels"
"github.com/zitadel/zitadel/internal/notification/channels/fs"
"github.com/zitadel/zitadel/internal/notification/channels/log"
"github.com/zitadel/zitadel/internal/notification/channels/twilio"
)
func SMSChannels(ctx context.Context, twilioConfig *twilio.TwilioConfig, getFileSystemProvider func(ctx context.Context) (*fs.FSConfig, error), getLogProvider func(ctx context.Context) (*log.LogConfig, error)) (chain *Chain, err error) {
channels := make([]channels.NotificationChannel, 0, 3)
if twilioConfig != nil {
chain.channels = append(chain.channels, twilio.InitTwilioChannel(*twilioConfig))
channels = append(channels, twilio.InitTwilioChannel(*twilioConfig))
}
chain, err = debugChannels(ctx, getFileSystemProvider, getLogProvider)
if err != nil {
return nil, err
}
return chain, nil
channels = append(channels, debugChannels(ctx, getFileSystemProvider, getLogProvider)...)
return chainChannels(channels...), nil
}