fix(api): sort upstreams in the API response

This commit is contained in:
Łukasz Mierzwa
2019-10-21 11:40:34 +01:00
parent 752d93b4d8
commit acb6eab2ac

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"net/http"
"net/url"
"sort"
"sync"
"time"
@@ -82,6 +83,9 @@ func GetAlertmanagers() []*Alertmanager {
for _, am := range upstreams {
ams = append(ams, am)
}
sort.Slice(ams[:], func(i, j int) bool {
return ams[i].Name < ams[j].Name
})
return ams
}