improve error handling for datasources as cfg

This commit is contained in:
bergquist
2017-12-08 10:50:11 +01:00
parent c766802325
commit 5f5cdad97a
5 changed files with 79 additions and 6 deletions

View File

@@ -118,13 +118,19 @@ func (configReader) readConfig(path string) ([]*DatasourcesAsConfig, error) {
return nil, err
}
datasources = append(datasources, datasource)
if datasource != nil {
datasources = append(datasources, datasource)
}
}
}
defaultCount := 0
for _, cfg := range datasources {
for _, ds := range cfg.Datasources {
for i := range datasources {
if datasources[i].Datasources == nil {
continue
}
for _, ds := range datasources[i].Datasources {
if ds.OrgId == 0 {
ds.OrgId = 1
}
@@ -137,7 +143,7 @@ func (configReader) readConfig(path string) ([]*DatasourcesAsConfig, error) {
}
}
for _, ds := range cfg.DeleteDatasources {
for _, ds := range datasources[i].DeleteDatasources {
if ds.OrgId == 0 {
ds.OrgId = 1
}