2017-07-10 14:58:12 +00:00
|
|
|
package types
|
|
|
|
|
2017-08-21 08:46:03 +00:00
|
|
|
import "strings"
|
|
|
|
|
2017-10-10 09:10:02 +00:00
|
|
|
// Traefik labels
|
2017-07-10 14:58:12 +00:00
|
|
|
const (
|
2017-10-10 09:10:02 +00:00
|
|
|
LabelPrefix = "traefik."
|
|
|
|
LabelDomain = LabelPrefix + "domain"
|
|
|
|
LabelEnable = LabelPrefix + "enable"
|
|
|
|
LabelPort = LabelPrefix + "port"
|
|
|
|
LabelPortIndex = LabelPrefix + "portIndex"
|
|
|
|
LabelProtocol = LabelPrefix + "protocol"
|
|
|
|
LabelTags = LabelPrefix + "tags"
|
|
|
|
LabelWeight = LabelPrefix + "weight"
|
|
|
|
LabelFrontendAuthBasic = LabelPrefix + "frontend.auth.basic"
|
|
|
|
LabelFrontendEntryPoints = LabelPrefix + "frontend.entryPoints"
|
2017-10-20 15:14:03 +00:00
|
|
|
LabelFrontendRequestHeader = LabelPrefix + "frontend.headers.customrequestheaders"
|
2017-11-03 13:32:03 +00:00
|
|
|
LabelFrontendResponseHeader = LabelPrefix + "frontend.headers.customresponseheaders"
|
2017-10-10 09:10:02 +00:00
|
|
|
LabelFrontendPassHostHeader = LabelPrefix + "frontend.passHostHeader"
|
2017-11-20 01:12:03 +00:00
|
|
|
LabelFrontendPassTLSCert = LabelPrefix + "frontend.passTLSCert"
|
2017-10-10 09:10:02 +00:00
|
|
|
LabelFrontendPriority = LabelPrefix + "frontend.priority"
|
|
|
|
LabelFrontendRule = LabelPrefix + "frontend.rule"
|
|
|
|
LabelFrontendRuleType = LabelPrefix + "frontend.rule.type"
|
2017-11-18 12:50:03 +00:00
|
|
|
LabelFrontendRedirect = LabelPrefix + "frontend.redirect"
|
2017-10-10 09:10:02 +00:00
|
|
|
LabelTraefikFrontendValue = LabelPrefix + "frontend.value"
|
|
|
|
LabelTraefikFrontendWhitelistSourceRange = LabelPrefix + "frontend.whitelistSourceRange"
|
|
|
|
LabelBackend = LabelPrefix + "backend"
|
|
|
|
LabelBackendID = LabelPrefix + "backend.id"
|
|
|
|
LabelTraefikBackendCircuitbreaker = LabelPrefix + "backend.circuitbreaker"
|
|
|
|
LabelBackendCircuitbreakerExpression = LabelPrefix + "backend.circuitbreaker.expression"
|
|
|
|
LabelBackendHealthcheckPath = LabelPrefix + "backend.healthcheck.path"
|
|
|
|
LabelBackendHealthcheckInterval = LabelPrefix + "backend.healthcheck.interval"
|
|
|
|
LabelBackendLoadbalancerMethod = LabelPrefix + "backend.loadbalancer.method"
|
|
|
|
LabelBackendLoadbalancerSticky = LabelPrefix + "backend.loadbalancer.sticky"
|
|
|
|
LabelBackendLoadbalancerStickiness = LabelPrefix + "backend.loadbalancer.stickiness"
|
|
|
|
LabelBackendLoadbalancerStickinessCookieName = LabelPrefix + "backend.loadbalancer.stickiness.cookieName"
|
|
|
|
LabelBackendMaxconnAmount = LabelPrefix + "backend.maxconn.amount"
|
|
|
|
LabelBackendMaxconnExtractorfunc = LabelPrefix + "backend.maxconn.extractorfunc"
|
2017-07-10 14:58:12 +00:00
|
|
|
)
|
2017-08-21 08:46:03 +00:00
|
|
|
|
|
|
|
//ServiceLabel converts a key value of Label*, given a serviceName, into a pattern <LabelPrefix>.<serviceName>.<property>
|
|
|
|
// i.e. For LabelFrontendRule and serviceName=app it will return "traefik.app.frontend.rule"
|
|
|
|
func ServiceLabel(key, serviceName string) string {
|
|
|
|
if len(serviceName) > 0 {
|
|
|
|
property := strings.TrimPrefix(key, LabelPrefix)
|
|
|
|
return LabelPrefix + serviceName + "." + property
|
|
|
|
}
|
|
|
|
return key
|
|
|
|
}
|