Created
July 16, 2019 11:40
-
-
Save adamw/fcc0016fde3c7a13d9c0e65360af5e7c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait EmailModule extends BaseModule { | |
lazy val emailService = new EmailService(idGenerator, emailSender, config.email, xa) | |
// the EmailService implements the EmailScheduler functionality - hence, creating | |
// an alias for this dependency | |
lazy val emailScheduler: EmailScheduler = emailService | |
lazy val emailTemplates = new EmailTemplates() | |
// depending on the configuration, creating the appropriate EmailSender instance | |
lazy val emailSender: EmailSender = if (config.email.mailgun.enabled) { | |
new MailgunEmailSender(config.email.mailgun)(sttpBackend) | |
} else if (config.email.smtp.enabled) { | |
new SmtpEmailSender(config.email.smtp) | |
} else { | |
DummyEmailSender | |
} | |
def xa: Transactor[Task] | |
def sttpBackend: SttpBackend[Task, Nothing] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment