Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Commit

Permalink
Merge pull request #898 from aledbf/sort-locations
Browse files Browse the repository at this point in the history
NGINX Ingress controller Sort locations
  • Loading branch information
bprashanth committed May 4, 2016
2 parents 0068579 + d229b99 commit c99db95
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ingress/controllers/nginx/nginx/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,13 @@ type Location struct {
}

// LocationByPath sorts location by path
// Location / is the last one
type LocationByPath []*Location

func (c LocationByPath) Len() int { return len(c) }
func (c LocationByPath) Swap(i, j int) { c[i], c[j] = c[j], c[i] }
func (c LocationByPath) Less(i, j int) bool {
return c[i].Path < c[j].Path
return c[i].Path > c[j].Path
}

// NewDefaultServer return an UpstreamServer to be use as default server that returns 503.
Expand Down

0 comments on commit c99db95

Please sign in to comment.