-
Notifications
You must be signed in to change notification settings - Fork 14
/
mail.go
28 lines (25 loc) · 928 Bytes
/
mail.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package registry
import (
"github.com/latolukasz/beeorm"
"github.com/sarulabs/di"
"github.com/coretrix/hitrix/service"
"github.com/coretrix/hitrix/service/component/clock"
"github.com/coretrix/hitrix/service/component/config"
errorlogger "github.com/coretrix/hitrix/service/component/error_logger"
"github.com/coretrix/hitrix/service/component/mail"
)
// ServiceProviderMail Be sure that you registered entity MailTrackerEntity
func ServiceProviderMail(newFunc mail.NewSenderFunc) *service.DefinitionGlobal {
return &service.DefinitionGlobal{
Name: service.MailService,
Build: func(ctn di.Container) (interface{}, error) {
return mail.NewSender(
ctn.Get(service.ORMConfigService).(beeorm.ValidatedRegistry),
ctn.Get(service.ConfigService).(config.IConfig),
ctn.Get(service.ClockService).(clock.IClock),
ctn.Get(service.ErrorLoggerService).(errorlogger.ErrorLogger),
newFunc,
)
},
}
}