mirror of
https://github.com/openziti/zrok.git
synced 2024-11-07 08:44:14 +01:00
26 lines
582 B
Go
26 lines
582 B
Go
package emailUi
|
|
|
|
import (
|
|
"bytes"
|
|
"github.com/pkg/errors"
|
|
"text/template"
|
|
)
|
|
|
|
type WarningEmail struct {
|
|
EmailAddress string
|
|
Detail string
|
|
Version string
|
|
}
|
|
|
|
func (we WarningEmail) MergeTemplate(filename string) (string, error) {
|
|
t, err := template.ParseFS(FS, filename)
|
|
if err != nil {
|
|
return "", errors.Wrapf(err, "error parsing warning email template '%v'", filename)
|
|
}
|
|
buf := new(bytes.Buffer)
|
|
if err := t.Execute(buf, we); err != nil {
|
|
return "", errors.Wrapf(err, "error executing warning email template '%v'", filename)
|
|
}
|
|
return buf.String(), nil
|
|
}
|