feat(kv): add frontend redirect configuration.
This commit is contained in:
parent
40b59da224
commit
cfa1f47226
4 changed files with 99 additions and 0 deletions
|
@ -33,6 +33,8 @@ func (p *Provider) buildConfiguration() *types.Configuration {
|
|||
"Last": p.last,
|
||||
"Has": p.has,
|
||||
|
||||
// Frontend functions
|
||||
"getRedirect": p.getRedirect,
|
||||
// Backend functions
|
||||
"getSticky": p.getSticky,
|
||||
"hasStickinessLabel": p.hasStickinessLabel,
|
||||
|
@ -77,6 +79,23 @@ func (p *Provider) getStickinessCookieName(rootPath string) string {
|
|||
return p.get("", rootPath, pathBackendLoadBalancerStickinessCookieName)
|
||||
}
|
||||
|
||||
func (p *Provider) getRedirect(rootPath string) *types.Redirect {
|
||||
if p.has(rootPath, pathFrontendRedirectEntryPoint) {
|
||||
return &types.Redirect{
|
||||
EntryPoint: p.get("", rootPath, pathFrontendRedirectEntryPoint),
|
||||
}
|
||||
}
|
||||
|
||||
if p.has(rootPath, pathFrontendRedirectRegex) && p.has(rootPath, pathFrontendRedirectReplacement) {
|
||||
return &types.Redirect{
|
||||
Regex: p.get("", rootPath, pathFrontendRedirectRegex),
|
||||
Replacement: p.get("", rootPath, pathFrontendRedirectReplacement),
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *Provider) listServers(backend string) []string {
|
||||
serverNames := p.list(backend, pathBackendServers)
|
||||
return fun.Filter(p.serverFilter, serverNames).([]string)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue