Commit d1e292eb authored by Bobby Rullo's avatar Bobby Rullo

server: pass issuer name to emailer

Issuer name can be used in Emailer
parent c94e5384
...@@ -85,7 +85,7 @@ func (cfg *ServerConfig) Server() (*Server, error) { ...@@ -85,7 +85,7 @@ func (cfg *ServerConfig) Server() (*Server, error) {
return nil, err return nil, err
} }
err = setEmailer(&srv, cfg.EmailFromAddress, cfg.EmailerConfigFile, cfg.EmailTemplateDirs) err = setEmailer(&srv, cfg.IssuerName, cfg.EmailFromAddress, cfg.EmailerConfigFile, cfg.EmailTemplateDirs)
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -238,7 +238,7 @@ func setTemplates(srv *Server, tpls *template.Template) error { ...@@ -238,7 +238,7 @@ func setTemplates(srv *Server, tpls *template.Template) error {
return nil return nil
} }
func setEmailer(srv *Server, fromAddress, emailerConfigFile string, emailTemplateDirs []string) error { func setEmailer(srv *Server, issuerName, fromAddress, emailerConfigFile string, emailTemplateDirs []string) error {
cfg, err := email.NewEmailerConfigFromFile(emailerConfigFile) cfg, err := email.NewEmailerConfigFromFile(emailerConfigFile)
if err != nil { if err != nil {
...@@ -290,6 +290,9 @@ func setEmailer(srv *Server, fromAddress, emailerConfigFile string, emailTemplat ...@@ -290,6 +290,9 @@ func setEmailer(srv *Server, fromAddress, emailerConfigFile string, emailTemplat
} }
} }
tMailer := email.NewTemplatizedEmailerFromTemplates(textTemplates, htmlTemplates, emailer) tMailer := email.NewTemplatizedEmailerFromTemplates(textTemplates, htmlTemplates, emailer)
tMailer.SetGlobalContext(map[string]interface{}{
"issuer_name": issuerName,
})
ue := useremail.NewUserEmailer(srv.UserRepo, ue := useremail.NewUserEmailer(srv.UserRepo,
srv.PasswordInfoRepo, srv.PasswordInfoRepo,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment