source id reordering

This commit is contained in:
Matthias Hannig 2017-06-26 16:41:50 +02:00
parent efe9394ca2
commit 7f3cc5c938
2 changed files with 7 additions and 4 deletions

View File

@ -127,9 +127,9 @@ func apiRouteserversList(_req *http.Request, _params httprouter.Params) (api.Res
routeservers := []api.Routeserver{}
sources := AliceConfig.Sources
for id, source := range sources {
for _, source := range sources {
routeservers = append(routeservers, api.Routeserver{
Id: id,
Id: source.Id,
Name: source.Name,
})
}

View File

@ -184,7 +184,8 @@ func getSources(config *ini.File) ([]SourceConfig, error) {
sources := []SourceConfig{}
sourceSections := config.ChildSections("source")
for id, section := range sourceSections {
sourceId := 0
for _, section := range sourceSections {
if !isSourceBase(section) {
continue
}
@ -212,7 +213,7 @@ func getSources(config *ini.File) ([]SourceConfig, error) {
// Make config
config := SourceConfig{
Id: id,
Id: sourceId,
Name: section.Key("name").MustString("Unknown Source"),
Type: backendType,
}
@ -227,6 +228,8 @@ func getSources(config *ini.File) ([]SourceConfig, error) {
// Add to list of sources
sources = append(sources, config)
sourceId += 1
}
return sources, nil