From bbf831afae2251aa1b7f433718fb8f9ae2daea1c Mon Sep 17 00:00:00 2001 From: andyxning Date: Tue, 29 Dec 2020 13:52:10 +0800 Subject: [PATCH] add string split function to template funcMap --- docs/user-guide/nginx-configuration/custom-template.md | 1 + internal/ingress/controller/template/template.go | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/user-guide/nginx-configuration/custom-template.md b/docs/user-guide/nginx-configuration/custom-template.md index 0cbb540c4..211223025 100644 --- a/docs/user-guide/nginx-configuration/custom-template.md +++ b/docs/user-guide/nginx-configuration/custom-template.md @@ -30,6 +30,7 @@ In addition to the built-in functions provided by the Go package the following f - hasSuffix: [strings.HasSuffix](https://golang.org/pkg/strings/#HasSuffix) - toUpper: [strings.ToUpper](https://golang.org/pkg/strings/#ToUpper) - toLower: [strings.ToLower](https://golang.org/pkg/strings/#ToLower) +- split: [strings.Split](https://golang.org/pkg/strings/#Split) - quote: wraps a string in double quotes - buildLocation: helps to build the NGINX Location section in each server - buildProxyPass: builds the reverse proxy configuration diff --git a/internal/ingress/controller/template/template.go b/internal/ingress/controller/template/template.go index 3a6f02c64..e59f7458c 100644 --- a/internal/ingress/controller/template/template.go +++ b/internal/ingress/controller/template/template.go @@ -152,6 +152,7 @@ var ( "buildDenyVariable": buildDenyVariable, "getenv": os.Getenv, "contains": strings.Contains, + "split": strings.Split, "hasPrefix": strings.HasPrefix, "hasSuffix": strings.HasSuffix, "trimSpace": strings.TrimSpace,