Remove interface

This commit is contained in:
Manuel de Brito Fontes 2016-11-11 20:43:35 -03:00
parent ed9a416b01
commit f2b627486d
13 changed files with 72 additions and 872 deletions

View file

@ -197,7 +197,7 @@ func buildProxyPass(input interface{}) string {
proto = "https"
}
// defProxyPass returns the default proxy_pass, just the name of the upstream
defProxyPass := fmt.Sprintf("proxy_pass %s://%s;", proto, location.Upstream.Name)
defProxyPass := fmt.Sprintf("proxy_pass %s://%s;", proto, location.Backend.Name)
// if the path in the ingress rule is equals to the target: no special rewrite
if path == location.Redirect.Target {
return defProxyPass
@ -227,13 +227,13 @@ func buildProxyPass(input interface{}) string {
rewrite %s(.*) /$1 break;
rewrite %s / break;
proxy_pass %s://%s;
%v`, path, location.Path, proto, location.Upstream.Name, abu)
%v`, path, location.Path, proto, location.Backend.Name, abu)
}
return fmt.Sprintf(`
rewrite %s(.*) %s/$1 break;
proxy_pass %s://%s;
%v`, path, location.Redirect.Target, proto, location.Upstream.Name, abu)
%v`, path, location.Redirect.Target, proto, location.Backend.Name, abu)
}
// default proxy_pass

View file

@ -88,7 +88,7 @@ func TestBuildProxyPass(t *testing.T) {
loc := &ingress.Location{
Path: tc.Path,
Redirect: rewrite.Redirect{Target: tc.Target, AddBaseURL: tc.AddBaseURL},
Upstream: ingress.Upstream{Name: "upstream-name"},
Upstream: ingress.Backend{Name: "upstream-name"},
}
pp := buildProxyPass(loc)