feat: custom label shorthands
This commit is contained in:
parent
c826cc97e6
commit
b4ef1baf65
8 changed files with 144 additions and 16 deletions
|
@ -396,8 +396,8 @@ func AddStore(configuration *dynamic.TLSConfiguration, storeName string, store t
|
|||
return reflect.DeepEqual(configuration.Stores[storeName], store)
|
||||
}
|
||||
|
||||
// MakeDefaultRuleTemplate creates the default rule template.
|
||||
func MakeDefaultRuleTemplate(defaultRule string, funcMap template.FuncMap) (*template.Template, error) {
|
||||
// MakeAnyTemplate creates a template with any name
|
||||
func MakeAnyTemplate(name string, value string, funcMap template.FuncMap) (*template.Template, error) {
|
||||
defaultFuncMap := sprig.TxtFuncMap()
|
||||
defaultFuncMap["normalize"] = Normalize
|
||||
|
||||
|
@ -405,7 +405,12 @@ func MakeDefaultRuleTemplate(defaultRule string, funcMap template.FuncMap) (*tem
|
|||
defaultFuncMap[k] = fn
|
||||
}
|
||||
|
||||
return template.New("defaultRule").Funcs(defaultFuncMap).Parse(defaultRule)
|
||||
return template.New(name).Funcs(defaultFuncMap).Parse(value)
|
||||
}
|
||||
|
||||
// MakeDefaultRuleTemplate creates the default rule template.
|
||||
func MakeDefaultRuleTemplate(defaultRule string, funcMap template.FuncMap) (*template.Template, error) {
|
||||
return MakeAnyTemplate("defaultRule", defaultRule, funcMap)
|
||||
}
|
||||
|
||||
// BuildTCPRouterConfiguration builds a router configuration.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue