mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-14 06:06:38 +01:00
feat(docs): add template preview (#1777)
This commit is contained in:
parent
9b28fbc24d
commit
9180e9558e
15 changed files with 944 additions and 20 deletions
|
|
@ -10,10 +10,9 @@ import (
|
|||
|
||||
"github.com/containrrr/shoutrrr"
|
||||
"github.com/containrrr/shoutrrr/pkg/types"
|
||||
"github.com/containrrr/watchtower/pkg/notifications/templates"
|
||||
t "github.com/containrrr/watchtower/pkg/types"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"golang.org/x/text/cases"
|
||||
"golang.org/x/text/language"
|
||||
)
|
||||
|
||||
// LocalLog is a logrus logger that does not send entries as notifications
|
||||
|
|
@ -208,13 +207,8 @@ func (n *shoutrrrTypeNotifier) Fire(entry *log.Entry) error {
|
|||
}
|
||||
|
||||
func getShoutrrrTemplate(tplString string, legacy bool) (tpl *template.Template, err error) {
|
||||
funcs := template.FuncMap{
|
||||
"ToUpper": strings.ToUpper,
|
||||
"ToLower": strings.ToLower,
|
||||
"ToJSON": toJSON,
|
||||
"Title": cases.Title(language.AmericanEnglish).String,
|
||||
}
|
||||
tplBase := template.New("").Funcs(funcs)
|
||||
|
||||
tplBase := template.New("").Funcs(templates.Funcs)
|
||||
|
||||
if builtin, found := commonTemplates[tplString]; found {
|
||||
log.WithField(`template`, tplString).Debug(`Using common template`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue