Skip to content

Commit

Permalink
Make sure websocket users/nkeys strings array is sorted for reload
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
  • Loading branch information
kozlovic committed Sep 9, 2020
1 parent ed3eba8 commit b4d7de5
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions server/reload.go
Original file line number Diff line number Diff line change
Expand Up @@ -754,9 +754,7 @@ func imposeOrder(value interface{}) error {
return value[i].String() < value[j].String()
})
case []string:
sort.Slice(value, func(i, j int) bool {
return value[i] < value[j]
})
sort.Strings(value)
case []*jwt.OperatorClaims:
sort.Slice(value, func(i, j int) bool {
return value[i].Issuer < value[j].Issuer
Expand All @@ -766,9 +764,9 @@ func imposeOrder(value interface{}) error {
return value.Gateways[i].Name < value.Gateways[j].Name
})
case WebsocketOpts:
sort.Slice(value.AllowedOrigins, func(i, j int) bool {
return value.AllowedOrigins[i] < value.AllowedOrigins[j]
})
sort.Strings(value.AllowedOrigins)
sort.Strings(value.Users)
sort.Strings(value.Nkeys)
case string, bool, int, int32, int64, time.Duration, float64, nil,
LeafNodeOpts, ClusterOpts, *tls.Config, *URLAccResolver, *MemAccResolver, *DirAccResolver, *CacheDirAccResolver, Authentication:
// explicitly skipped types
Expand Down

0 comments on commit b4d7de5

Please sign in to comment.