fix reading toml for output and database
This commit is contained in:
parent
18c0362021
commit
773545643c
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
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)
|
||||
return nil, fmt.Errorf("the output type '%s' has the wrong format: read format %T should be an []map[string]interface{}", outputType, configForOutput)
|
||||
}
|
||||
for _, config := range outputConfigs {
|
||||
if c, ok := config["enable"].(bool); ok && !c {
|
||||
continue
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue