Skip to content

Commit

Permalink
checking the condition inside iteration
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Balogh <[email protected]>
  • Loading branch information
pbalogh-sa committed Mar 28, 2020
1 parent 2694598 commit 89c53bc
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,17 @@ func isServiceEnabled(ctx context.Context, banzaiCLI cli.Cli, serviceName string

serviceName = strings.ToLower(serviceName)
if services, ok := capabilities[serviceKeyOnCap]; ok {
lowerCaseServiceMap := map[string]interface{}{}
var (
s interface{}
ok bool
)
for k, v := range services {
lowerCaseServiceMap[strings.ToLower(k)] = v
if strings.ToLower(k) == serviceName {
s, ok = v, true
break
}
}

if s, ok := lowerCaseServiceMap[serviceName]; ok {
if ok {
if svc, ok := s.(map[string]interface{}); ok {
if en, ok := svc[enabledKeyOnCap]; ok {
if enabled, ok := en.(bool); ok {
Expand Down

0 comments on commit 89c53bc

Please sign in to comment.