mirror of
https://github.com/nais/wonderwall.git
synced 2026-08-19 02:56:15 +00:00
refactor(ingress): simplify and remove unnecessary variables
This commit is contained in:
+1
-10
@@ -60,24 +60,15 @@ func (i *Ingresses) Strings() []string {
|
||||
}
|
||||
|
||||
func (i *Ingresses) MatchingIngress(r *http.Request) (Ingress, bool) {
|
||||
var match Ingress
|
||||
found := false
|
||||
|
||||
for _, ingress := range i.ingressMap {
|
||||
hostMatch := ingress.Host() == r.Host || ingress.Host() == r.Header.Get(XForwardedHost)
|
||||
pathMatch := ingress.Path() == i.MatchingPath(r)
|
||||
|
||||
if hostMatch && pathMatch {
|
||||
match = ingress
|
||||
found = true
|
||||
break
|
||||
return ingress, true
|
||||
}
|
||||
}
|
||||
|
||||
if found {
|
||||
return match, true
|
||||
}
|
||||
|
||||
return Ingress{}, false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user