feat(mail): add MailSender port and explicit provider selection

This commit is contained in:
shira committed 2026-10-06 00:38:58 +03:00
1 parent e7d0d92ef9
commit 6153887eb5
26 files changed
+1253 -29

No files matched your search

+5 -2
View File
@@ -17,13 +17,16 @@ import (
"lincodex/backend/internal/adapter/secondary/redis"
"lincodex/backend/internal/adapter/secondary/seaweedfs"
"lincodex/backend/internal/port/inbound"
"lincodex/backend/internal/port/outbound"
"lincodex/backend/internal/usecase/health"
"log/slog"
)
// Injectors from wire.go:
func initialize(ctx context.Context, config2 config.Config, logger *slog.Logger) (*Application, func(), error) {
// initialize receives the mail sender that start selected, so an unusable
// EMAIL_PROVIDER fails before any dependency is created.
func initialize(ctx context.Context, config2 config.Config, logger *slog.Logger, mailSender outbound.MailSender) (*Application, func(), error) {
healthChecker, cleanup, err := postgres.NewHealthChecker(ctx, config2)
if err != nil {
return nil, nil, err
@@ -52,7 +55,7 @@ func initialize(ctx context.Context, config2 config.Config, logger *slog.Logger)
cleanup()
return nil, nil, err
}
application := NewApplication(config2, httpHandler, metrics, logger)
application := NewApplication(config2, httpHandler, metrics, logger, mailSender)
return application, func() {
cleanup3()
cleanup2()