Skip to content
This repository has been archived by the owner on Mar 28, 2020. It is now read-only.

Commit

Permalink
Fix apps order
Browse files Browse the repository at this point in the history
Signed-off-by: Valentin Pichard <[email protected]>
  • Loading branch information
Valentin Pichard committed May 1, 2019
1 parent 556fb37 commit 1415346
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions helper/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package helper

import (
"fmt"
"sort"
"strings"

log "github.com/Sirupsen/logrus"
Expand Down Expand Up @@ -29,8 +30,16 @@ func retrieveStatusData() (*pumaStatusFinalOutput, error) {
appCount := 0
apps := []pumaStatusApplication{}

for appname, key := range CfgFile.Applications {
if Filter != "" && !strings.Contains(appname, Filter) {
sortedApps := make([]string, 0, len(CfgFile.Applications))
for k := range CfgFile.Applications {
sortedApps = append(sortedApps, k)
}
sort.Strings(sortedApps)

for _, appName := range sortedApps {
key := CfgFile.Applications[appName]

if Filter != "" && !strings.Contains(appName, Filter) {
continue
}

Expand All @@ -41,7 +50,7 @@ func retrieveStatusData() (*pumaStatusFinalOutput, error) {

ps, err := readPumaStats(pspath)
if err != nil {
log.Warn(fmt.Sprintf("[%s] configuration is invalid. Error: %v\n\n", appname, err))
log.Warn(fmt.Sprintf("[%s] configuration is invalid. Error: %v\n\n", appName, err))
continue
}

Expand Down Expand Up @@ -93,7 +102,7 @@ func retrieveStatusData() (*pumaStatusFinalOutput, error) {
}

app := pumaStatusApplication{
Name: appname,
Name: appName,
Description: key.Description,
RootPath: key.Path,
PumaStatePath: pspath,
Expand Down

0 comments on commit 1415346

Please sign in to comment.