[BUGFIX] convert config in steps
This commit is contained in:
parent
63b1d994a6
commit
94c9dd2f6c
@ -22,12 +22,16 @@ func Connect(allConnection map[string]interface{}) (database.Connection, error)
|
|||||||
log.Printf("the output type '%s' has no configuration", dbType)
|
log.Printf("the output type '%s' has no configuration", dbType)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
dbConfigs, ok := configForType.([]map[string]interface{})
|
dbConfigs, ok := configForType.([]interface{})
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("the output type '%s' has the wrong format", dbType)
|
return nil, fmt.Errorf("the database type '%s' has the wrong format", dbType)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, config := range dbConfigs {
|
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)
|
||||||
|
}
|
||||||
if c, ok := config["enable"].(bool); ok && !c {
|
if c, ok := config["enable"].(bool); ok && !c {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -38,14 +38,14 @@ func TestStart(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
"b": nil,
|
"b": nil,
|
||||||
"c": []map[string]interface{}{
|
"c": []interface{}{
|
||||||
{
|
map[string]interface{}{
|
||||||
"path": "c1",
|
"path": "c1",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// fetch continue command in Connect
|
// fetch continue command in Connect
|
||||||
"d": []map[string]interface{}{
|
"d": []interface{}{
|
||||||
{
|
map[string]interface{}{
|
||||||
"path": "d0",
|
"path": "d0",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -25,11 +25,15 @@ func Register(configuration map[string]interface{}) (output.Output, error) {
|
|||||||
log.Printf("the output type '%s' has no configuration\n", outputType)
|
log.Printf("the output type '%s' has no configuration\n", outputType)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
outputConfigs, ok := configForOutput.([]map[string]interface{})
|
outputConfigs, ok := configForOutput.([]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 {
|
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", outputType)
|
||||||
}
|
}
|
||||||
for _, config := range outputConfigs {
|
|
||||||
if c, ok := config["enable"].(bool); ok && !c {
|
if c, ok := config["enable"].(bool); ok && !c {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -49,29 +49,29 @@ func TestStart(t *testing.T) {
|
|||||||
return nil, errors.New("blub")
|
return nil, errors.New("blub")
|
||||||
})
|
})
|
||||||
allOutput, err := Register(map[string]interface{}{
|
allOutput, err := Register(map[string]interface{}{
|
||||||
"a": []map[string]interface{}{
|
"a": []interface{}{
|
||||||
{
|
map[string]interface{}{
|
||||||
"enable": false,
|
"enable": false,
|
||||||
"path": "a1",
|
"path": "a1",
|
||||||
},
|
},
|
||||||
{
|
map[string]interface{}{
|
||||||
"path": "a2",
|
"path": "a2",
|
||||||
},
|
},
|
||||||
{
|
map[string]interface{}{
|
||||||
"enable": true,
|
"enable": true,
|
||||||
"path": "a3",
|
"path": "a3",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"b": nil,
|
"b": nil,
|
||||||
"c": []map[string]interface{}{
|
"c": []interface{}{
|
||||||
{
|
map[string]interface{}{
|
||||||
"path": "c1",
|
"path": "c1",
|
||||||
"filter": map[string]interface{}{},
|
"filter": map[string]interface{}{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// fetch continue command in Connect
|
// fetch continue command in Connect
|
||||||
"d": []map[string]interface{}{
|
"d": []interface{}{
|
||||||
{
|
map[string]interface{}{
|
||||||
"path": "d0",
|
"path": "d0",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user