mirror of
https://github.com/coredns/coredns.git
synced 2025-12-14 22:35:10 -05:00
plugin/template: Add parseInt template function (#5609)
* plugin/template: Add parseInt template function Signed-off-by: Erik Johansson <ejohansson@spotify.com>
This commit is contained in:
@@ -150,6 +150,13 @@ func executeRRTemplate(server, view, section string, template *gotmpl.Template,
|
||||
return rr, nil
|
||||
}
|
||||
|
||||
func newTemplate(name, text string) (*gotmpl.Template, error) {
|
||||
funcMap := gotmpl.FuncMap{
|
||||
"parseInt": strconv.ParseUint,
|
||||
}
|
||||
return gotmpl.New(name).Funcs(funcMap).Parse(text)
|
||||
}
|
||||
|
||||
func (t template) match(ctx context.Context, state request.Request) (*templateData, bool, bool) {
|
||||
q := state.Req.Question[0]
|
||||
data := &templateData{md: metadata.ValueFuncs(ctx), Remote: state.IP()}
|
||||
|
||||
Reference in New Issue
Block a user