Skip to content

Commit

Permalink
Router template optimization
Browse files Browse the repository at this point in the history
This PR introduces some optimizations to router template files, which
simplify the structure of the template file, improve compatibility for
future HAPROXY versions, and improve maintainancibility of template-related
codes. Major optimizations include:

1. Move template helper functions, as well as the mapping structure,
into a new .go file named `template_helper.go`
2. Replace the non-standard form `listen stats :<port>` which is forbidden
by HAPROXY 1.7.0+ with the standard form `listen stats` and `bind :<port>`.
3. Introduce two new helper functions: `firstMatch` and `isTrue`. `firstMatch`
matches the regexp given in the first argument with the following string
arguments and returns the first matched string, while `isTrue` is a
proxy for Go's `strconv.ParseBool`.
4. Change the `env` function to take variable args: `env(name, def...)`.
It accepts multiple default values, but only the first non-empty default
value takes effect if the environment variable is not defined. If no
default value is given, or all default values are empty, then it treats
`""` as the default value.
5. Eliminate many unnecessary `{{if}}`s from the template file through
the introduction of `firstMatch` function. The result is the size of the
template file is significantly reduced.
  • Loading branch information
louyihua committed Aug 22, 2017
1 parent e08b0d7 commit 2ed8547
Show file tree
Hide file tree
Showing 6 changed files with 532 additions and 482 deletions.
159 changes: 45 additions & 114 deletions images/router/haproxy/conf/haproxy-config.template
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@
{{/* cidrListPattern: Match a space separated list of CIDRs; e.g. 192.168.21.23/24 192.10.2.12 */}}
{{- $cidrListPattern := printf `(?:%s(?: +%s)*)` $cidrPattern $cidrPattern -}}

{{- $timeSpecRE := "[1-9][0-9]*(us|ms|s|m|h|d)?" }}
global
maxconn {{env "ROUTER_MAX_CONNECTIONS" "20000"}}

daemon
{{- with (env "ROUTER_SYSLOG_ADDRESS" "") }}
{{- with (env "ROUTER_SYSLOG_ADDRESS") }}
log {{.}} {{env "ROUTER_LOG_FACILITY" "local1"}} {{env "ROUTER_LOG_LEVEL" "warning"}}
{{- end}}
ca-base /etc/ssl
Expand Down Expand Up @@ -76,9 +77,9 @@ defaults
maxconn {{env "ROUTER_MAX_CONNECTIONS" "20000"}}

# Add x-forwarded-for header.
{{- if ne (env "ROUTER_SYSLOG_ADDRESS" "") "" }}
{{- if ne (env "ROUTER_SYSLOG_FORMAT" "") "" }}
log-format {{env "ROUTER_SYSLOG_FORMAT" ""}}
{{- if ne (env "ROUTER_SYSLOG_ADDRESS") "" }}
{{- if ne (env "ROUTER_SYSLOG_FORMAT") "" }}
log-format {{env "ROUTER_SYSLOG_FORMAT"}}
{{- else }}
option httplog
{{- end }}
Expand All @@ -92,62 +93,25 @@ defaults
# server openshift_backend 127.0.0.1:8080
errorfile 503 /var/lib/haproxy/conf/error-page-503.http

{{- if (matchPattern "[1-9][0-9]*(us|ms|s|m|h|d)?" (env "ROUTER_DEFAULT_CONNECT_TIMEOUT" "")) }}
timeout connect {{env "ROUTER_DEFAULT_CONNECT_TIMEOUT" "5s"}}
{{- else }}
timeout connect 5s
{{- end }}
{{- if (matchPattern "[1-9][0-9]*(us|ms|s|m|h|d)?" (env "ROUTER_DEFAULT_CLIENT_TIMEOUT" "")) }}
timeout client {{env "ROUTER_DEFAULT_CLIENT_TIMEOUT" "30s"}}
{{- else }}
timeout client 30s
{{- end }}
{{- if (matchPattern "[1-9][0-9]*(us|ms|s|m|h|d)?" (env "ROUTER_CLIENT_FIN_TIMEOUT" "")) }}
timeout client-fin {{env "ROUTER_CLIENT_FIN_TIMEOUT" "1s"}}
{{- else }}
timeout client-fin 1s
{{- end }}
{{- if (matchPattern "[1-9][0-9]*(us|ms|s|m|h|d)?" (env "ROUTER_DEFAULT_SERVER_TIMEOUT" "")) }}
timeout server {{env "ROUTER_DEFAULT_SERVER_TIMEOUT" "30s"}}
{{- else }}
timeout server 30s
{{- end }}
{{- if (matchPattern "[1-9][0-9]*(us|ms|s|m|h|d)?" (env "ROUTER_DEFAULT_SERVER_FIN_TIMEOUT" "")) }}
timeout server-fin {{env "ROUTER_DEFAULT_SERVER_FIN_TIMEOUT" "1s"}}
{{- else }}
timeout server-fin 1s
{{- end }}
{{- if (matchPattern "[1-9][0-9]*(us|ms|s|m|h|d)?" (env "ROUTER_SLOWLORIS_TIMEOUT" "")) }}
timeout http-request {{env "ROUTER_SLOWLORIS_TIMEOUT" "10s" }}
{{- else }}
timeout http-request 10s
{{- end }}
{{- if (matchPattern "[1-9][0-9]*(us|ms|s|m|h|d)?" (env "ROUTER_SLOWLORIS_HTTP_KEEPALIVE" "")) }}
timeout http-keep-alive {{env "ROUTER_SLOWLORIS_HTTP_KEEPALIVE" "" }}
{{- else }}
timeout http-keep-alive 300s
{{- end }}
timeout connect {{firstMatch $timeSpecRE (env "ROUTER_DEFAULT_CONNECT_TIMEOUT") "5s"}}
timeout client {{firstMatch $timeSpecRE (env "ROUTER_DEFAULT_CLIENT_TIMEOUT") "30s"}}
timeout client-fin {{firstMatch $timeSpecRE (env "ROUTER_CLIENT_FIN_TIMEOUT") "1s"}}
timeout server {{firstMatch $timeSpecRE (env "ROUTER_DEFAULT_SERVER_TIMEOUT") "30s"}}
timeout server-fin {{firstMatch $timeSpecRE (env "ROUTER_DEFAULT_SERVER_FIN_TIMEOUT") "1s"}}
timeout http-request {{firstMatch $timeSpecRE (env "ROUTER_SLOWLORIS_TIMEOUT") "10s" }}
timeout http-keep-alive {{firstMatch $timeSpecRE (env "ROUTER_SLOWLORIS_HTTP_KEEPALIVE") "300s" }}

# Long timeout for WebSocket connections.
{{- if (matchPattern "[1-9][0-9]*(us|ms|s|m|h|d)?" (env "ROUTER_DEFAULT_TUNNEL_TIMEOUT" "")) }}
timeout tunnel {{env "ROUTER_DEFAULT_TUNNEL_TIMEOUT" "1h" }}
{{- else }}
timeout tunnel 1h
{{- end }}
timeout tunnel {{firstMatch $timeSpecRE (env "ROUTER_DEFAULT_TUNNEL_TIMEOUT") "1h" }}

{{- if (matchPattern "true|TRUE" (env "ROUTER_ENABLE_COMPRESSION" "false")) }}
{{- if isTrue (env "ROUTER_ENABLE_COMPRESSION") }}
compression algo gzip
{{- with $mimeType := (env "ROUTER_COMPRESSION_MIME" "text/html text/plain text/css") }}
compression type {{$mimeType}}
{{- end }}
compression type {{env "ROUTER_COMPRESSION_MIME" "text/html text/plain text/css"}}
{{- end }}

{{ if (gt .StatsPort -1) }}
{{ if (gt .StatsPort 0) }}
listen stats :{{.StatsPort}}
{{- else }}
listen stats :1936
{{- end }}
listen stats
bind :{{if (gt .StatsPort 0)}}{{.StatsPort}}{{else}}1936{{end}}
mode http
# Health check monitoring uri.
monitor-uri /healthz
Expand All @@ -172,7 +136,7 @@ frontend public
{{- else }}
bind :{{env "ROUTER_SERVICE_HTTP_PORT" "80"}}
{{- end }}
{{- if matchPattern "true|TRUE" (env "ROUTER_USE_PROXY_PROTOCOL" "") }} accept-proxy{{ end }}
{{- if isTrue (env "ROUTER_USE_PROXY_PROTOCOL") }} accept-proxy{{ end }}
mode http
tcp-request inspect-delay 5s
tcp-request content accept if HTTP
Expand Down Expand Up @@ -215,7 +179,7 @@ frontend public_ssl
{{- else }}
bind :{{env "ROUTER_SERVICE_HTTPS_PORT" "443"}}
{{- end }}
{{- if matchPattern "true|TRUE" (env "ROUTER_USE_PROXY_PROTOCOL" "") }} accept-proxy{{ end }}
{{- if isTrue (env "ROUTER_USE_PROXY_PROTOCOL") }} accept-proxy{{ end }}
tcp-request inspect-delay 5s
tcp-request content accept if { req_ssl_hello_type 1 }

Expand Down Expand Up @@ -249,8 +213,8 @@ backend be_sni
frontend fe_sni
# terminate ssl on edge
bind 127.0.0.1:{{env "ROUTER_SERVICE_SNI_PORT" "10444"}} ssl no-sslv3
{{- if matchPattern "true|TRUE" (env "ROUTER_STRICT_SNI" "") }} strict-sni {{ end }}
{{- if gt (len .DefaultCertificate) 0 }} crt {{.DefaultCertificate}}{{ else }} crt /var/lib/haproxy/conf/default_pub_keys.pem{{ end }}
{{- if isTrue (env "ROUTER_STRICT_SNI") }} strict-sni {{ end }}
{{- ""}} crt {{firstMatch ".+" .DefaultCertificate "/var/lib/haproxy/conf/default_pub_keys.pem"}}
{{- ""}} crt-list /var/lib/haproxy/conf/cert_config.map accept-proxy
mode http

Expand Down Expand Up @@ -292,7 +256,7 @@ backend be_no_sni

frontend fe_no_sni
# terminate ssl on edge
bind 127.0.0.1:{{env "ROUTER_SERVICE_NO_SNI_PORT" "10443"}} ssl no-sslv3 {{ if gt (len .DefaultCertificate) 0 }}crt {{.DefaultCertificate}}{{ else }}crt /var/lib/haproxy/conf/default_pub_keys.pem{{ end }} accept-proxy
bind 127.0.0.1:{{env "ROUTER_SERVICE_NO_SNI_PORT" "10443"}} ssl no-sslv3 crt {{firstMatch ".+" .DefaultCertificate "/var/lib/haproxy/conf/default_pub_keys.pem"}} accept-proxy
mode http

# Strip off Proxy headers to prevent HTTpoxy (https://httpoxy.org/)
Expand Down Expand Up @@ -343,7 +307,7 @@ backend openshift_default
passed through to the backend pod by just looking at the TCP headers.
*/}}
{{- range $cfgIdx, $cfg := .State }}
{{- if or (eq $cfg.TLSTermination "") (eq $cfg.TLSTermination "edge") (eq $cfg.TLSTermination "reencrypt") }}
{{- if matchValues (print $cfg.TLSTermination) "" "edge" "reencrypt" }}
{{- if (eq $cfg.TLSTermination "") }}

# Plain http backend
Expand All @@ -360,30 +324,25 @@ backend be_secure:{{$cfgIdx}}
mode http
option redispatch
option forwardfor
{{- with $balanceAlgo := index $cfg.Annotations "haproxy.router.openshift.io/balance" }}
{{- with $matchValue := (matchValues $balanceAlgo "roundrobin" "leastconn" "source" ) }}

{{- with $balanceAlgo := firstMatch "roundrobin|leastconn|source" (index $cfg.Annotations "haproxy.router.openshift.io/balance") (env "ROUTER_LOAD_BALANCE_ALGORITHM") }}
balance {{ $balanceAlgo }}
{{- end }}
{{- else }}
{{- if (matchPattern "roundrobin|leastconn|source" (env "ROUTER_LOAD_BALANCE_ALGORITHM" "")) }}
balance {{ env "ROUTER_LOAD_BALANCE_ALGORITHM" "leastconn"}}
{{- else }}
balance {{ if gt $cfg.ActiveServiceUnits 1 }}roundrobin{{ else }}leastconn{{ end }}
{{- end }}
{{- end }}
{{- with $ip_whiteList := index $cfg.Annotations "haproxy.router.openshift.io/ip_whitelist" }}
{{- if (matchPattern $cidrListPattern $ip_whiteList) }}
{{- with $ip_whiteList := firstMatch $cidrListPattern (index $cfg.Annotations "haproxy.router.openshift.io/ip_whitelist") }}
acl whitelist src {{ $ip_whiteList }}
tcp-request content reject if !whitelist
{{- end }}
{{- end }}
{{- with $value := index $cfg.Annotations "haproxy.router.openshift.io/timeout"}}
{{- if (matchPattern "[1-9][0-9]*(us|ms|s|m|h|d)?" $value) }}
{{- with $value := firstMatch $timeSpecRE (index $cfg.Annotations "haproxy.router.openshift.io/timeout")}}
timeout server {{$value}}
{{- end }}
{{- end }} {{/* end balance algorithm setting. */}}

{{- if matchPattern "true|TRUE" (index $cfg.Annotations "haproxy.router.openshift.io/rate-limit-connections") }}
{{- with $value := firstMatch $timeSpecRE (index $cfg.Annotations "haproxy.router.openshift.io/timeout") }}
timeout server {{$value}}
{{- end }}

{{- if isTrue (index $cfg.Annotations "haproxy.router.openshift.io/rate-limit-connections") }}
stick-table type ip size 100k expire 30s store conn_cur,conn_rate(3s),http_req_rate(10s)
tcp-request content track-sc2 src
{{- if (isInteger (index $cfg.Annotations "haproxy.router.openshift.io/rate-limit-connections.concurrent-tcp")) }}
Expand Down Expand Up @@ -417,9 +376,9 @@ backend be_secure:{{$cfgIdx}}
http-request set-header Forwarded for=%[src];host=%[req.hdr(host)];proto=%[req.hdr(X-Forwarded-Proto)]
{{- end }}

{{- if not (matchPattern "true|TRUE" (index $cfg.Annotations "haproxy.router.openshift.io/disable_cookies")) }}
{{- if not (isTrue (index $cfg.Annotations "haproxy.router.openshift.io/disable_cookies")) }}
cookie {{$cfg.RoutingKeyName}} insert indirect nocache httponly
{{- if and (or (eq $cfg.TLSTermination "edge") (eq $cfg.TLSTermination "reencrypt")) (ne $cfg.InsecureEdgeTerminationPolicy "Allow") }} secure
{{- if and (matchValues (print $cfg.TLSTermination) "edge" "reencrypt") (ne $cfg.InsecureEdgeTerminationPolicy "Allow") }} secure
{{- end }}
{{- end }}{{/* end disable cookies check */}}

Expand All @@ -442,16 +401,7 @@ backend be_secure:{{$cfgIdx}}
{{- else if or (eq $cfg.TLSTermination "") (eq $cfg.TLSTermination "edge") }}
{{- end }}{{/* end type specific options*/}}

{{- if not $endpoint.NoHealthCheck }}
{{- with $healthIntv := index $cfg.Annotations "router.openshift.io/haproxy.health.check.interval" }}
{{- if (matchPattern "[1-9][0-9]*(us|ms|s|m|h|d)?" $healthIntv) }} check inter {{$healthIntv}}
{{- else }} check inter 5000ms
{{- end }}
{{- else }}
{{- if (matchPattern "[1-9][0-9]*(us|ms|s|m|h|d)?" (env "ROUTER_BACKEND_CHECK_INTERVAL" "")) }} check inter {{env "ROUTER_BACKEND_CHECK_INTERVAL" "5000ms"}}
{{- else }} check inter 5000ms
{{- end }}
{{- end }}{{/* end get health interval annotation */}}
{{- if not $endpoint.NoHealthCheck }} check inter {{firstMatch $timeSpecRE (index $cfg.Annotations "router.openshift.io/haproxy.health.check.interval") (env "ROUTER_BACKEND_CHECK_INTERVAL") "5000ms"}}
{{- end }}{{/* end else no health check */}}


Expand All @@ -466,33 +416,23 @@ backend be_secure:{{$cfgIdx}}

# Secure backend, pass through
backend be_tcp:{{$cfgIdx}}
{{- if ne (env "ROUTER_SYSLOG_ADDRESS" "") ""}}
{{- if ne (env "ROUTER_SYSLOG_ADDRESS") ""}}
option tcplog
{{- end }}
{{- with $balanceAlgo := index $cfg.Annotations "haproxy.router.openshift.io/balance" }}
{{- with $matchValue := (matchValues $balanceAlgo "roundrobin" "leastconn" "source" ) }}
{{- with $balanceAlgo := firstMatch "roundrobin|leastconn|source" (index $cfg.Annotations "haproxy.router.openshift.io/balance") (env "ROUTER_LOAD_BALANCE_ALGORITHM") }}
balance {{ $balanceAlgo }}
{{- end }}
{{- else }}
{{- if (matchPattern "roundrobin|leastconn|source" (env "ROUTER_TCP_BALANCE_SCHEME" "")) }}
balance {{ env "ROUTER_TCP_BALANCE_SCHEME" "source"}}
{{- else }}
balance {{ if gt $cfg.ActiveServiceUnits 1 }}roundrobin{{ else }}source{{ end }}
{{- end }}
{{- end }}
{{- with $ip_whiteList := index $cfg.Annotations "haproxy.router.openshift.io/ip_whitelist" }}
{{- if (matchPattern $cidrListPattern $ip_whiteList) }}
{{- with $ip_whiteList := firstMatch $cidrListPattern (index $cfg.Annotations "haproxy.router.openshift.io/ip_whitelist") }}
acl whitelist src {{$ip_whiteList}}
tcp-request content reject if !whitelist
{{- end }}
{{- end }}
{{- with $value := index $cfg.Annotations "haproxy.router.openshift.io/timeout"}}
{{- if (matchPattern "[1-9][0-9]*(us|ms|s|m|h|d)?" $value) }}
{{- with $value := firstMatch $timeSpecRE (index $cfg.Annotations "haproxy.router.openshift.io/timeout")}}
timeout tunnel {{$value}}
{{- end }}
{{- end }}

{{- if matchPattern "true|TRUE" (index $cfg.Annotations "haproxy.router.openshift.io/rate-limit-connections") }}
{{- if isTrue (index $cfg.Annotations "haproxy.router.openshift.io/rate-limit-connections") }}
stick-table type ip size 100k expire 30s store conn_cur,conn_rate(3s),http_req_rate(10s)
tcp-request content track-sc2 src
{{- if (isInteger (index $cfg.Annotations "haproxy.router.openshift.io/rate-limit-connections.concurrent-tcp")) }}
Expand All @@ -515,16 +455,7 @@ backend be_tcp:{{$cfgIdx}}
{{- with $serviceUnit := index $.ServiceUnits $serviceUnitName }}
{{- range $idx, $endpoint := processEndpointsForAlias $cfg $serviceUnit (env "ROUTER_BACKEND_PROCESS_ENDPOINTS" "") }}
server {{$endpoint.ID}} {{$endpoint.IP}}:{{$endpoint.Port}} weight {{$weight}}
{{- if not $endpoint.NoHealthCheck }}
{{- with $healthIntv := index $cfg.Annotations "router.openshift.io/haproxy.health.check.interval" }}
{{- if (matchPattern "[1-9][0-9]*(us|ms|s|m|h|d)?" $healthIntv) }} check inter {{$healthIntv}}
{{- else }} check inter 5000ms
{{- end }}
{{- else }}
{{- if (matchPattern "[1-9][0-9]*(us|ms|s|m|h|d)?" (env "ROUTER_BACKEND_CHECK_INTERVAL" "")) }} check inter {{env "ROUTER_BACKEND_CHECK_INTERVAL" "5000ms"}}
{{- else }} check inter 5000ms
{{- end }}
{{- end }}{{/* end get health interval annotation */}}
{{- if not $endpoint.NoHealthCheck }} check inter {{firstMatch $timeSpecRE (index $cfg.Annotations "router.openshift.io/haproxy.health.check.interval") (env "ROUTER_BACKEND_CHECK_INTERVAL") "5000ms"}}
{{- end }}{{/* end else no health check */}}
{{- end }}{{/* end range processEndpointsForAlias */}}
{{- end }}{{/* end get ServiceUnit from serviceUnitName */}}
Expand All @@ -545,7 +476,7 @@ backend be_tcp:{{$cfgIdx}}
a host matches a [sub]domain with has wildcard support.
*/}}
{{ define "/var/lib/haproxy/conf/os_wildcard_domain.map" -}}
{{ if matchPattern "true|TRUE" (env "ROUTER_ALLOW_WILDCARD_ROUTES" "") -}}
{{ if isTrue (env "ROUTER_ALLOW_WILDCARD_ROUTES") -}}
{{ range $idx, $cfg := .State -}}
{{ if ne $cfg.Host "" -}}
{{ if $cfg.IsWildcard -}}
Expand Down Expand Up @@ -587,7 +518,7 @@ backend be_tcp:{{$cfgIdx}}
*/}}
{{ define "/var/lib/haproxy/conf/os_route_http_expose.map" -}}
{{ range $idx, $cfg := .State -}}
{{ if and (ne $cfg.Host "") (and (or (eq $cfg.TLSTermination "edge") (eq $cfg.TLSTermination "reencrypt")) (eq $cfg.InsecureEdgeTerminationPolicy "Allow")) -}}
{{ if and (ne $cfg.Host "") (and (matchValues (print $cfg.TLSTermination) "edge" "reencrypt") (eq $cfg.InsecureEdgeTerminationPolicy "Allow")) -}}
{{ if (eq $cfg.TLSTermination "edge") -}}
{{generateRouteRegexp $cfg.Host $cfg.Path $cfg.IsWildcard}} be_edge_http:{{$idx}}
{{ else -}}
Expand Down Expand Up @@ -617,7 +548,7 @@ backend be_tcp:{{$cfgIdx}}
*/}}
{{ define "/var/lib/haproxy/conf/os_tcp_be.map" -}}
{{ range $idx, $cfg := .State -}}
{{ if and (eq $cfg.Path "") (and (ne $cfg.Host "") (or (eq $cfg.TLSTermination "passthrough") (eq $cfg.TLSTermination "reencrypt"))) -}}
{{ if and (eq $cfg.Path "") (and (ne $cfg.Host "") (matchValues (print $cfg.TLSTermination) "passthrough" "reencrypt")) -}}
{{generateRouteRegexp $cfg.Host "" $cfg.IsWildcard}} {{$idx}}
{{ end -}}
{{ end -}}
Expand Down Expand Up @@ -659,7 +590,7 @@ backend be_tcp:{{$cfgIdx}}
{{ define "/var/lib/haproxy/conf/cert_config.map" -}}
{{ $workingDir := .WorkingDir -}}
{{ range $idx, $cfg := .State -}}
{{ if and (ne $cfg.Host "") (or (eq $cfg.TLSTermination "edge") (eq $cfg.TLSTermination "reencrypt")) -}}
{{ if and (ne $cfg.Host "") (matchValues (print $cfg.TLSTermination) "edge" "reencrypt") -}}
{{ $cert := index $cfg.Certificates $cfg.Host -}}
{{ if ne $cert.Contents "" -}}
{{$workingDir}}/certs/{{$idx}}.pem {{genCertificateHostName $cfg.Host $cfg.IsWildcard}}
Expand Down
23 changes: 1 addition & 22 deletions pkg/router/template/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package templaterouter
import (
"crypto/md5"
"fmt"
"os"
"path/filepath"
"strconv"
"text/template"
Expand Down Expand Up @@ -91,30 +90,10 @@ type routerInterface interface {
Commit()
}

func env(name, defaultValue string) string {
if envValue := os.Getenv(name); envValue != "" {
return envValue
}

return defaultValue
}

// NewTemplatePlugin creates a new TemplatePlugin.
func NewTemplatePlugin(cfg TemplatePluginConfig, lookupSvc ServiceLookup) (*TemplatePlugin, error) {
templateBaseName := filepath.Base(cfg.TemplatePath)
globalFuncs := template.FuncMap{
"endpointsForAlias": endpointsForAlias, //returns the list of valid endpoints
"processEndpointsForAlias": processEndpointsForAlias, //returns the list of valid endpoints after processing them
"env": env, //tries to get an environment variable if it can't return a default
"matchPattern": matchPattern, //anchors provided regular expression and evaluates against given string
"isInteger": isInteger, //determines if a given variable is an integer
"matchValues": matchValues, //compares a given string to a list of allowed strings

"genSubdomainWildcardRegexp": genSubdomainWildcardRegexp, //generates a regular expression matching the subdomain for hosts (and paths) with a wildcard policy
"generateRouteRegexp": generateRouteRegexp, //generates a regular expression matching the route hosts (and paths)
"genCertificateHostName": genCertificateHostName, //generates host name to use for serving/matching certificates
}
masterTemplate, err := template.New("config").Funcs(globalFuncs).ParseFiles(cfg.TemplatePath)
masterTemplate, err := template.New("config").Funcs(helperFunctions).ParseFiles(cfg.TemplatePath)
if err != nil {
return nil, err
}
Expand Down
Loading

0 comments on commit 2ed8547

Please sign in to comment.