mirror of
https://github.com/prometheus/alertmanager
synced 2024-12-26 16:12:20 +00:00
Merge pull request #168 from prometheus/stattmpl
Statically compile default templates
This commit is contained in:
commit
eebde79c66
1
Makefile
1
Makefile
@ -44,6 +44,7 @@ assets:
|
||||
@echo ">> writing assets"
|
||||
-@$(GO) get -u github.com/jteeuwen/go-bindata/...
|
||||
@go-bindata $(bindata_flags) -pkg ui -o ui/bindata.go ui/...
|
||||
@go-bindata $(bindata_flags) -pkg deftmpl -o template/internal/deftmpl/bindata.go template/default.tmpl
|
||||
|
||||
|
||||
.PHONY: all format build test vet assets
|
||||
|
237
template/internal/deftmpl/bindata.go
Normal file
237
template/internal/deftmpl/bindata.go
Normal file
File diff suppressed because one or more lines are too long
@ -24,6 +24,7 @@ import (
|
||||
|
||||
"github.com/prometheus/common/model"
|
||||
|
||||
"github.com/prometheus/alertmanager/template/internal/deftmpl"
|
||||
"github.com/prometheus/alertmanager/types"
|
||||
)
|
||||
|
||||
@ -47,6 +48,17 @@ func FromGlobs(paths ...string) (*Template, error) {
|
||||
t.text = t.text.Funcs(tmpltext.FuncMap(DefaultFuncs))
|
||||
t.html = t.html.Funcs(tmplhtml.FuncMap(DefaultFuncs))
|
||||
|
||||
b, err := deftmpl.Asset("template/default.tmpl")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if t.text, err = t.text.Parse(string(b)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if t.html, err = t.html.Parse(string(b)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, tp := range paths {
|
||||
if t.text, err = t.text.ParseGlob(tp); err != nil {
|
||||
return nil, err
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user