diff --git a/database/all/connection.go b/database/all/connection.go index e85bfaa..23fd14b 100644 --- a/database/all/connection.go +++ b/database/all/connection.go @@ -23,16 +23,12 @@ func Connect(allConnection map[string]interface{}) (database.Connection, error) log.WithField("database", dbType).Infof("no configuration found") continue } - dbConfigs, ok := configForType.([]interface{}) + dbConfigs, ok := configForType.([]map[string]interface{}) if !ok { - return nil, fmt.Errorf("the database type '%s' has the wrong format", dbType) + return nil, fmt.Errorf("the database type '%s' has the wrong format: read format %T should be an []map[string]interface{}", dbType, configForType) } - for _, dbConfig := range dbConfigs { - config, ok := dbConfig.(map[string]interface{}) - if !ok { - return nil, fmt.Errorf("the database type '%s' has the wrong format", dbType) - } + for _, config := range dbConfigs { if c, ok := config["enable"].(bool); ok && !c { continue } diff --git a/output/all/output.go b/output/all/output.go index 14d1cc1..73c1383 100644 --- a/output/all/output.go +++ b/output/all/output.go @@ -27,15 +27,11 @@ func Register(configuration map[string]interface{}) (output.Output, error) { log.WithField("output", outputType).Infof("no configuration found") continue } - outputConfigs, ok := configForOutput.([]interface{}) + outputConfigs, ok := configForOutput.([]map[string]interface{}) if !ok { - return nil, fmt.Errorf("the output type '%s' has the wrong format", outputType) + return nil, fmt.Errorf("the output type '%s' has the wrong format: read format %T should be an []map[string]interface{}", outputType, configForOutput) } - for _, outputConfig := range outputConfigs { - config, ok := outputConfig.(map[string]interface{}) - if !ok { - return nil, fmt.Errorf("the output type '%s' has the wrong format", outputType) - } + for _, config := range outputConfigs { if c, ok := config["enable"].(bool); ok && !c { continue }