-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
63 additions
and
52 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
src/main/kotlin/pt/up/fe/ni/website/backend/config/email/EmailConfig.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package pt.up.fe.ni.website.backend.config.email | ||
|
||
import com.samskivert.mustache.Mustache | ||
import org.commonmark.ext.front.matter.YamlFrontMatterExtension | ||
import org.commonmark.parser.Parser | ||
import org.commonmark.renderer.html.HtmlRenderer | ||
import org.commonmark.renderer.text.TextContentRenderer | ||
import org.springframework.boot.autoconfigure.mustache.MustacheResourceTemplateLoader | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
|
||
@Configuration | ||
class EmailConfig( | ||
private val emailConfigProperties: EmailConfigProperties | ||
) { | ||
@Bean | ||
fun mustacheCompiler() = Mustache.compiler().withLoader( | ||
MustacheResourceTemplateLoader(emailConfigProperties.templatePrefix, emailConfigProperties.templateSuffix) | ||
) | ||
|
||
@Bean | ||
fun commonmarkParser() = Parser.builder().extensions( | ||
listOf( | ||
YamlFrontMatterExtension.create() | ||
) | ||
).build() | ||
|
||
@Bean | ||
fun commonmarkHtmlRenderer() = HtmlRenderer.builder().build() | ||
|
||
@Bean | ||
fun commonmarkTextRenderer() = TextContentRenderer.builder().build() | ||
} |
This file contains 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
3 changes: 1 addition & 2 deletions
3
src/main/kotlin/pt/up/fe/ni/website/backend/email/EmailBuilder.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
package pt.up.fe.ni.website.backend.email | ||
|
||
import org.springframework.mail.javamail.MimeMessageHelper | ||
import pt.up.fe.ni.website.backend.config.email.EmailConfigProperties | ||
|
||
interface EmailBuilder { | ||
fun build(helper: MimeMessageHelper, emailConfigProperties: EmailConfigProperties) | ||
fun build(helper: MimeMessageHelper) | ||
} |
This file contains 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
This file contains 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
This file contains 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