Skip to content

Commit

Permalink
change allowed svcs map type
Browse files Browse the repository at this point in the history
  • Loading branch information
schallert committed Mar 6, 2019
1 parent c31e3da commit f911a3e
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/query/api/v1/handler/allowed_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

package handler

type allowedServicesSet map[string]bool
type allowedServicesSet map[string]struct{}

func (a allowedServicesSet) String() []string {
s := make([]string, 0, len(a))
Expand All @@ -32,9 +32,9 @@ func (a allowedServicesSet) String() []string {

var (
allowedServices = allowedServicesSet{
M3DBServiceName: true,
M3AggregatorServiceName: true,
M3CoordinatorServiceName: true,
M3DBServiceName: struct{}{},
M3AggregatorServiceName: struct{}{},
M3CoordinatorServiceName: struct{}{},
}
)

Expand All @@ -47,10 +47,8 @@ func IsAllowedService(svc string) bool {
// AllowedServices returns the list of valid M3 services.
func AllowedServices() []string {
svcs := make([]string, 0, len(allowedServices))
for svc, allowed := range allowedServices {
if allowed {
svcs = append(svcs, svc)
}
for svc := range allowedServices {
svcs = append(svcs, svc)
}
return svcs
}

0 comments on commit f911a3e

Please sign in to comment.