rework template rendering, cache parsed templates
adapt error wrapping principle
This commit is contained in:
parent
7a1448d6f9
commit
f04396809d
21 changed files with 175 additions and 82 deletions
|
@ -11,8 +11,8 @@ import (
|
|||
"math/big"
|
||||
"net/smtp"
|
||||
"officeHours/config"
|
||||
"officeHours/controllers"
|
||||
"officeHours/models"
|
||||
"officeHours/templating"
|
||||
)
|
||||
|
||||
type RequestRepo struct {
|
||||
|
@ -131,12 +131,13 @@ func (r *RequestRepo) sendConfirmationMail(request models.Request) error {
|
|||
Config config.Config
|
||||
Request models.Request
|
||||
}{r.config, request}
|
||||
err := controllers.RawTemplates.ExecuteTemplate(&message, "confirmationMail", data)
|
||||
err := templating.WriteTemplate(&message, "confirmationMail", data)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Error parsing confirmation Mail: %w", err)
|
||||
log.Println(err.Error())
|
||||
return err
|
||||
}
|
||||
|
||||
switch r.config.Mailer.Type {
|
||||
case "Stdout":
|
||||
fmt.Println(message.String())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue