mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-11 22:14:02 +01:00
@@ -14,6 +14,7 @@ identified with a specific icon:
|
||||
## Unreleased
|
||||
|
||||
- 🩹 *orchestrator*: validate configuration of other services on start
|
||||
- 🩹 *inlet*: correctly parse `inlet.snmp.communities` when it is just a string
|
||||
- 🌱 *inlet*: add `inlet.snmp.ports` to configure SNMP exporter ports
|
||||
|
||||
## 1.5.7 - 2022-08-23
|
||||
|
||||
@@ -105,13 +105,17 @@ func ConfigurationUnmarshallerHook() mapstructure.DecodeHookFunc {
|
||||
if mapKey == nil {
|
||||
// Use the fact we can set the default value directly.
|
||||
from.SetMapIndex(reflect.ValueOf("communities"), from.MapIndex(*defaultKey))
|
||||
} else if communities.Kind() == reflect.String {
|
||||
return nil, errors.New("do not provide default-community when using communities")
|
||||
} else {
|
||||
communities.SetMapIndex(reflect.ValueOf("::/0"), from.MapIndex(*defaultKey))
|
||||
}
|
||||
} else {
|
||||
// default-community should contain ::/0
|
||||
// communities should contain ::/0
|
||||
if mapKey == nil {
|
||||
from.SetMapIndex(reflect.ValueOf("communities"), reflect.ValueOf("public"))
|
||||
} else if communities.Kind() == reflect.String {
|
||||
// Do nothing
|
||||
} else if !communities.MapIndex(reflect.ValueOf("::/0")).IsValid() {
|
||||
communities.SetMapIndex(reflect.ValueOf("::/0"), reflect.ValueOf("public"))
|
||||
}
|
||||
|
||||
@@ -101,6 +101,29 @@ func TestConfigurationUnmarshallerHook(t *testing.T) {
|
||||
"::ffff:203.0.113.128/121": "private",
|
||||
}),
|
||||
},
|
||||
}, {
|
||||
Description: "communities as a string",
|
||||
Initial: func() interface{} { return Configuration{} },
|
||||
Configuration: func() interface{} {
|
||||
return gin.H{
|
||||
"communities": "private",
|
||||
}
|
||||
},
|
||||
Expected: Configuration{
|
||||
Communities: helpers.MustNewSubnetMap(map[string]string{
|
||||
"::/0": "private",
|
||||
}),
|
||||
},
|
||||
}, {
|
||||
Description: "communities as a string, default-community",
|
||||
Initial: func() interface{} { return Configuration{} },
|
||||
Configuration: func() interface{} {
|
||||
return gin.H{
|
||||
"default-community": "nothing",
|
||||
"communities": "private",
|
||||
}
|
||||
},
|
||||
Error: true,
|
||||
}, {
|
||||
Description: "communities, default-community empty",
|
||||
Initial: func() interface{} { return Configuration{} },
|
||||
|
||||
Reference in New Issue
Block a user