mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-15 04:18:01 +00:00
b5564572bc
This implementation increases parallel write capabilities of the eventstore. Please have a look at the technical advisories: [05](https://zitadel.com/docs/support/advisory/a10005) and [06](https://zitadel.com/docs/support/advisory/a10006). The implementation of eventstore.push is rewritten and stored events are migrated to a new table `eventstore.events2`. If you are using cockroach: make sure that the database user of ZITADEL has `VIEWACTIVITY` grant. This is used to query events.
45 lines
1.3 KiB
Go
45 lines
1.3 KiB
Go
package senders
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/zitadel/logging"
|
|
"github.com/zitadel/zitadel/internal/api/authz"
|
|
"github.com/zitadel/zitadel/internal/notification/channels"
|
|
"github.com/zitadel/zitadel/internal/notification/channels/fs"
|
|
"github.com/zitadel/zitadel/internal/notification/channels/instrumenting"
|
|
"github.com/zitadel/zitadel/internal/notification/channels/log"
|
|
"github.com/zitadel/zitadel/internal/notification/channels/smtp"
|
|
)
|
|
|
|
const smtpSpanName = "smtp.NotificationChannel"
|
|
|
|
func EmailChannels(
|
|
ctx context.Context,
|
|
emailConfig *smtp.Config,
|
|
getFileSystemProvider func(ctx context.Context) (*fs.Config, error),
|
|
getLogProvider func(ctx context.Context) (*log.Config, error),
|
|
successMetricName,
|
|
failureMetricName string,
|
|
) (chain *Chain, err error) {
|
|
channels := make([]channels.NotificationChannel, 0, 3)
|
|
p, err := smtp.InitChannel(emailConfig)
|
|
logging.WithFields(
|
|
"instance", authz.GetInstance(ctx).InstanceID(),
|
|
).OnError(err).Debug("initializing SMTP channel failed")
|
|
if err == nil {
|
|
channels = append(
|
|
channels,
|
|
instrumenting.Wrap(
|
|
ctx,
|
|
p,
|
|
smtpSpanName,
|
|
successMetricName,
|
|
failureMetricName,
|
|
),
|
|
)
|
|
}
|
|
channels = append(channels, debugChannels(ctx, getFileSystemProvider, getLogProvider)...)
|
|
return ChainChannels(channels...), nil
|
|
}
|