refactor(docker): re-order templates functions.
This commit is contained in:
parent
42b900b9b2
commit
50757b5e99
1 changed files with 31 additions and 24 deletions
|
@ -13,22 +13,14 @@ import (
|
||||||
|
|
||||||
func (p *Provider) buildConfiguration(containersInspected []dockerData) *types.Configuration {
|
func (p *Provider) buildConfiguration(containersInspected []dockerData) *types.Configuration {
|
||||||
var DockerFuncMap = template.FuncMap{
|
var DockerFuncMap = template.FuncMap{
|
||||||
"getBackend": getBackend,
|
"getDomain": getFuncStringLabel(label.TraefikDomain, p.Domain),
|
||||||
|
"isBackendLBSwarm": isBackendLBSwarm, // FIXME dead ?
|
||||||
|
|
||||||
|
// Backend functions
|
||||||
"getIPAddress": p.getIPAddress,
|
"getIPAddress": p.getIPAddress,
|
||||||
"getPort": getPort,
|
"getPort": getPort,
|
||||||
"getWeight": getFuncStringLabel(label.TraefikWeight, label.DefaultWeight),
|
"getWeight": getFuncStringLabel(label.TraefikWeight, label.DefaultWeight),
|
||||||
"getDomain": getFuncStringLabel(label.TraefikDomain, p.Domain),
|
|
||||||
"getProtocol": getFuncStringLabel(label.TraefikProtocol, label.DefaultProtocol),
|
"getProtocol": getFuncStringLabel(label.TraefikProtocol, label.DefaultProtocol),
|
||||||
"getPassHostHeader": getFuncStringLabel(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeader),
|
|
||||||
"getPassTLSCert": getFuncBoolLabel(label.TraefikFrontendPassTLSCert, label.DefaultPassTLSCert),
|
|
||||||
"getPriority": getFuncStringLabel(label.TraefikFrontendPriority, label.DefaultFrontendPriority),
|
|
||||||
"getEntryPoints": getFuncSliceStringLabel(label.TraefikFrontendEntryPoints),
|
|
||||||
"getBasicAuth": getFuncSliceStringLabel(label.TraefikFrontendAuthBasic),
|
|
||||||
"getFrontendRule": p.getFrontendRule,
|
|
||||||
"hasRedirect": hasRedirect,
|
|
||||||
"getRedirectEntryPoint": getFuncStringLabel(label.TraefikFrontendRedirectEntryPoint, label.DefaultFrontendRedirectEntryPoint),
|
|
||||||
"getRedirectRegex": getFuncStringLabel(label.TraefikFrontendRedirectRegex, ""),
|
|
||||||
"getRedirectReplacement": getFuncStringLabel(label.TraefikFrontendRedirectReplacement, ""),
|
|
||||||
"hasHealthCheckLabels": hasFunc(label.TraefikBackendHealthCheckPath),
|
"hasHealthCheckLabels": hasFunc(label.TraefikBackendHealthCheckPath),
|
||||||
"getHealthCheckPath": getFuncStringLabel(label.TraefikBackendHealthCheckPath, ""),
|
"getHealthCheckPath": getFuncStringLabel(label.TraefikBackendHealthCheckPath, ""),
|
||||||
"getHealthCheckPort": getFuncIntLabel(label.TraefikBackendHealthCheckPort, label.DefaultBackendHealthCheckPort),
|
"getHealthCheckPort": getFuncIntLabel(label.TraefikBackendHealthCheckPort, label.DefaultBackendHealthCheckPort),
|
||||||
|
@ -43,9 +35,21 @@ func (p *Provider) buildConfiguration(containersInspected []dockerData) *types.C
|
||||||
"getSticky": getSticky,
|
"getSticky": getSticky,
|
||||||
"hasStickinessLabel": hasFunc(label.TraefikBackendLoadBalancerStickiness),
|
"hasStickinessLabel": hasFunc(label.TraefikBackendLoadBalancerStickiness),
|
||||||
"getStickinessCookieName": getFuncStringLabel(label.TraefikBackendLoadBalancerStickinessCookieName, label.DefaultBackendLoadbalancerStickinessCookieName),
|
"getStickinessCookieName": getFuncStringLabel(label.TraefikBackendLoadBalancerStickinessCookieName, label.DefaultBackendLoadbalancerStickinessCookieName),
|
||||||
"isBackendLBSwarm": isBackendLBSwarm, // FIXME DEAD ?
|
|
||||||
"getWhitelistSourceRange": getFuncSliceStringLabel(label.TraefikFrontendWhitelistSourceRange),
|
|
||||||
|
|
||||||
|
// Frontend functions
|
||||||
|
"getBackend": getBackend,
|
||||||
|
"getPriority": getFuncStringLabel(label.TraefikFrontendPriority, label.DefaultFrontendPriority),
|
||||||
|
"getPassHostHeader": getFuncStringLabel(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeader),
|
||||||
|
"getPassTLSCert": getFuncBoolLabel(label.TraefikFrontendPassTLSCert, label.DefaultPassTLSCert),
|
||||||
|
"getEntryPoints": getFuncSliceStringLabel(label.TraefikFrontendEntryPoints),
|
||||||
|
"getBasicAuth": getFuncSliceStringLabel(label.TraefikFrontendAuthBasic),
|
||||||
|
"getWhitelistSourceRange": getFuncSliceStringLabel(label.TraefikFrontendWhitelistSourceRange),
|
||||||
|
"getFrontendRule": p.getFrontendRule,
|
||||||
|
"hasRedirect": hasRedirect,
|
||||||
|
"getRedirectEntryPoint": getFuncStringLabel(label.TraefikFrontendRedirectEntryPoint, label.DefaultFrontendRedirectEntryPoint),
|
||||||
|
"getRedirectRegex": getFuncStringLabel(label.TraefikFrontendRedirectRegex, ""),
|
||||||
|
"getRedirectReplacement": getFuncStringLabel(label.TraefikFrontendRedirectReplacement, ""),
|
||||||
|
// Headers
|
||||||
"hasRequestHeaders": hasFunc(label.TraefikFrontendRequestHeaders),
|
"hasRequestHeaders": hasFunc(label.TraefikFrontendRequestHeaders),
|
||||||
"getRequestHeaders": getFuncMapLabel(label.TraefikFrontendRequestHeaders),
|
"getRequestHeaders": getFuncMapLabel(label.TraefikFrontendRequestHeaders),
|
||||||
"hasResponseHeaders": hasFunc(label.TraefikFrontendResponseHeaders),
|
"hasResponseHeaders": hasFunc(label.TraefikFrontendResponseHeaders),
|
||||||
|
@ -87,16 +91,15 @@ func (p *Provider) buildConfiguration(containersInspected []dockerData) *types.C
|
||||||
"hasIsDevelopmentHeaders": hasFunc(label.TraefikFrontendIsDevelopment),
|
"hasIsDevelopmentHeaders": hasFunc(label.TraefikFrontendIsDevelopment),
|
||||||
"getIsDevelopmentHeaders": getFuncBoolLabel(label.TraefikFrontendIsDevelopment, false),
|
"getIsDevelopmentHeaders": getFuncBoolLabel(label.TraefikFrontendIsDevelopment, false),
|
||||||
|
|
||||||
"hasServices": hasServices,
|
// Services
|
||||||
"getServiceBackend": getServiceBackend,
|
"hasServices": hasServices,
|
||||||
"getServiceNames": getServiceNames,
|
"getServiceNames": getServiceNames,
|
||||||
"getServicePort": getServicePort,
|
"getServiceBackend": getServiceBackend,
|
||||||
"hasServiceRequestHeaders": hasFuncServiceLabel(label.SuffixFrontendRequestHeaders),
|
// Services - Backend server functions
|
||||||
"getServiceRequestHeaders": getFuncServiceMapLabel(label.SuffixFrontendRequestHeaders),
|
"getServicePort": getServicePort,
|
||||||
"hasServiceResponseHeaders": hasFuncServiceLabel(label.SuffixFrontendResponseHeaders),
|
"getServiceProtocol": getFuncServiceStringLabel(label.SuffixProtocol, label.DefaultProtocol),
|
||||||
"getServiceResponseHeaders": getFuncServiceMapLabel(label.SuffixFrontendResponseHeaders),
|
"getServiceWeight": getFuncServiceStringLabel(label.SuffixWeight, label.DefaultWeight),
|
||||||
"getServiceWeight": getFuncServiceStringLabel(label.SuffixWeight, label.DefaultWeight),
|
// Services - Frontend functions
|
||||||
"getServiceProtocol": getFuncServiceStringLabel(label.SuffixProtocol, label.DefaultProtocol),
|
|
||||||
"getServiceEntryPoints": getFuncServiceSliceStringLabel(label.SuffixFrontendEntryPoints),
|
"getServiceEntryPoints": getFuncServiceSliceStringLabel(label.SuffixFrontendEntryPoints),
|
||||||
"getServiceBasicAuth": getFuncServiceSliceStringLabel(label.SuffixFrontendAuthBasic),
|
"getServiceBasicAuth": getFuncServiceSliceStringLabel(label.SuffixFrontendAuthBasic),
|
||||||
"getServiceFrontendRule": p.getServiceFrontendRule,
|
"getServiceFrontendRule": p.getServiceFrontendRule,
|
||||||
|
@ -107,6 +110,10 @@ func (p *Provider) buildConfiguration(containersInspected []dockerData) *types.C
|
||||||
"getServiceRedirectEntryPoint": getFuncServiceStringLabel(label.SuffixFrontendRedirectEntryPoint, label.DefaultFrontendRedirectEntryPoint),
|
"getServiceRedirectEntryPoint": getFuncServiceStringLabel(label.SuffixFrontendRedirectEntryPoint, label.DefaultFrontendRedirectEntryPoint),
|
||||||
"getServiceRedirectReplacement": getFuncServiceStringLabel(label.SuffixFrontendRedirectReplacement, ""),
|
"getServiceRedirectReplacement": getFuncServiceStringLabel(label.SuffixFrontendRedirectReplacement, ""),
|
||||||
"getServiceRedirectRegex": getFuncServiceStringLabel(label.SuffixFrontendRedirectRegex, ""),
|
"getServiceRedirectRegex": getFuncServiceStringLabel(label.SuffixFrontendRedirectRegex, ""),
|
||||||
|
"hasServiceRequestHeaders": hasFuncServiceLabel(label.SuffixFrontendRequestHeaders),
|
||||||
|
"getServiceRequestHeaders": getFuncServiceMapLabel(label.SuffixFrontendRequestHeaders),
|
||||||
|
"hasServiceResponseHeaders": hasFuncServiceLabel(label.SuffixFrontendResponseHeaders),
|
||||||
|
"getServiceResponseHeaders": getFuncServiceMapLabel(label.SuffixFrontendResponseHeaders),
|
||||||
}
|
}
|
||||||
// filter containers
|
// filter containers
|
||||||
filteredContainers := fun.Filter(func(container dockerData) bool {
|
filteredContainers := fun.Filter(func(container dockerData) bool {
|
||||||
|
|
Loading…
Add table
Reference in a new issue