mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-12 06:24:10 +01:00
http: fix cache configuration marshal/unmarshal
Also, enable Redis by default, as stated in changelog.
This commit is contained in:
@@ -102,6 +102,10 @@ inlet:
|
||||
- ClassifyInternal()
|
||||
|
||||
console:
|
||||
http:
|
||||
cache:
|
||||
type: redis
|
||||
server: redis:6379
|
||||
database:
|
||||
saved-filters:
|
||||
# These are prepopulated filters you can select in a drop-down
|
||||
|
||||
@@ -144,7 +144,7 @@ func ParametrizedConfigurationUnmarshallerHook[OuterConfiguration any, InnerConf
|
||||
// Alter config with a copy of the concrete type
|
||||
defaultV := innerConfiguration()
|
||||
original := reflect.Indirect(reflect.ValueOf(defaultV))
|
||||
if !configField.IsNil() && configField.Elem().Type().Elem() == reflect.TypeOf(defaultV).Elem() {
|
||||
if !configField.IsNil() && configField.Elem().Type() == reflect.TypeOf(defaultV) {
|
||||
// Use the value we already have instead of default.
|
||||
original = reflect.Indirect(configField.Elem())
|
||||
}
|
||||
|
||||
@@ -100,6 +100,16 @@ func DefaultConfiguration() Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
// MarshalYAML undoes ConfigurationUnmarshallerHook().
|
||||
func (cc CacheConfiguration) MarshalYAML() (interface{}, error) {
|
||||
return helpers.ParametrizedConfigurationMarshalYAML(cc, cacheConfigurationMap)
|
||||
}
|
||||
|
||||
// MarshalJSON undoes ConfigurationUnmarshallerHook().
|
||||
func (cc CacheConfiguration) MarshalJSON() ([]byte, error) {
|
||||
return helpers.ParametrizedConfigurationMarshalJSON(cc, cacheConfigurationMap)
|
||||
}
|
||||
|
||||
var cacheConfigurationMap = map[string](func() CacheBackendConfiguration){
|
||||
"memory": DefaultMemoryCacheConfiguration,
|
||||
"redis": DefaultRedisCacheConfiguration,
|
||||
|
||||
Reference in New Issue
Block a user