in smtp/main.go [57:84]
func (s *smtpNotifier) SetUp(ctx context.Context, cfg *notifiers.Config, cfgTemplate string, sg notifiers.SecretGetter, br notifiers.BindingResolver) error {
prd, err := notifiers.MakeCELPredicate(cfg.Spec.Notification.Filter)
if err != nil {
return fmt.Errorf("failed to create CELPredicate: %w", err)
}
s.filter = prd
htmlTmpl, err := htmlTemplate.New("email_template").Parse(cfgTemplate)
if err != nil {
return fmt.Errorf("failed to parse HTML email template: %w", err)
}
s.htmlTmpl = htmlTmpl
if subject, subjectFound := cfg.Spec.Notification.Delivery["subject"]; subjectFound {
textTmpl, err := textTemplate.New("subject_template").Parse(subject.(string))
if err != nil {
return fmt.Errorf("failed to parse TEXT subject template: %w", err)
}
s.textTmpl = textTmpl
}
mcfg, err := getMailConfig(ctx, sg, cfg.Spec)
if err != nil {
return fmt.Errorf("failed to construct a mail delivery config: %w", err)
}
s.mcfg = mcfg
s.br = br
return nil
}