diff --git a/backend/api.go b/backend/api.go index 159d545..e1bf6a6 100644 --- a/backend/api.go +++ b/backend/api.go @@ -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, }) } diff --git a/backend/config.go b/backend/config.go index 74bcbf5..6b9daeb 100644 --- a/backend/config.go +++ b/backend/config.go @@ -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