forked from docker-flow/docker-flow-proxy
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
79 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,10 +111,18 @@ func (slice Services) Len() int { | |
func (slice Services) Less(i, j int) bool { | ||
firstHasRoot := hasRoot(slice[i]) | ||
secondHasRoot := hasRoot(slice[j]) | ||
if (firstHasRoot && secondHasRoot) || (!firstHasRoot && !secondHasRoot) { | ||
return slice[i].AclName < slice[j].AclName | ||
} else if firstHasRoot { | ||
firstHasWelKnown := hasWellKnown(slice[i]) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
vfarcic
Author
Owner
|
||
secondHasWelKnown := hasWellKnown(slice[j]) | ||
if firstHasRoot && !secondHasRoot { | ||
return false | ||
} else if !firstHasRoot && secondHasRoot { | ||
return true | ||
} else if firstHasWelKnown && !secondHasWelKnown { | ||
return true | ||
} else if !firstHasWelKnown && secondHasWelKnown { | ||
return false | ||
} else { | ||
return slice[i].AclName < slice[j].AclName | ||
} | ||
return true | ||
} | ||
|
@@ -130,6 +138,17 @@ func hasRoot(service Service) bool { | |
return false | ||
} | ||
|
||
func hasWellKnown(service Service) bool { | ||
for _, sd := range service.ServiceDest { | ||
for _, path := range sd.ServicePath { | ||
if strings.HasPrefix(strings.ToLower(path), "/.well-known") { | ||
return true | ||
} | ||
} | ||
} | ||
return false | ||
} | ||
|
||
func (slice Services) Swap(i, j int) { | ||
slice[i], slice[j] = slice[j], slice[i] | ||
} | ||
|
typo ? WelKnown ?