2022-01-06 08:00:24 +00:00
|
|
|
package senders
|
|
|
|
|
|
|
|
import (
|
2022-02-16 15:49:17 +00:00
|
|
|
"context"
|
|
|
|
|
2022-03-07 13:22:37 +00:00
|
|
|
"github.com/caos/logging"
|
2022-01-06 08:00:24 +00:00
|
|
|
"github.com/caos/zitadel/internal/config/systemdefaults"
|
2022-03-07 13:22:37 +00:00
|
|
|
"github.com/caos/zitadel/internal/notification/channels/fs"
|
|
|
|
"github.com/caos/zitadel/internal/notification/channels/log"
|
2022-01-06 08:00:24 +00:00
|
|
|
"github.com/caos/zitadel/internal/notification/channels/smtp"
|
|
|
|
)
|
|
|
|
|
2022-03-07 13:22:37 +00:00
|
|
|
func EmailChannels(ctx context.Context, config systemdefaults.Notifications, emailConfig func(ctx context.Context) (*smtp.EmailConfig, error), getFileSystemProvider func(ctx context.Context) (*fs.FSConfig, error), getLogProvider func(ctx context.Context) (*log.LogConfig, error)) (chain *Chain, err error) {
|
|
|
|
p, err := smtp.InitSMTPChannel(ctx, emailConfig)
|
|
|
|
if err == nil {
|
|
|
|
chain.channels = append(chain.channels, p)
|
2022-01-06 08:00:24 +00:00
|
|
|
}
|
2022-03-07 13:22:37 +00:00
|
|
|
chain, err = debugChannels(ctx, config, getFileSystemProvider, getLogProvider)
|
|
|
|
if err != nil {
|
|
|
|
logging.New().Info("Error in creating debug channels")
|
2022-01-06 08:00:24 +00:00
|
|
|
}
|
2022-03-07 13:22:37 +00:00
|
|
|
return chain, nil
|
2022-01-06 08:00:24 +00:00
|
|
|
}
|