Follow the keyvalue storage setting for things like cache and other

Signed-off-by: kolaente <k@knt.li>
This commit is contained in:
kolaente 2020-10-04 23:02:21 +02:00
parent 139fbab773
commit 1e757b00b4
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 16 additions and 4 deletions

View File

@ -61,8 +61,10 @@ database:
cache:
# If cache is enabled or not
enabled: false
# Cache type. Possible values are memory or redis, you'll need to enable redis below when using redis
type: memory
# Cache type. Possible values are "keyvalue", "memory" or "redis".
# When choosing "keyvalue" this setting follows the one configured in the "keyvalue" section.
# When choosing "redis" you will need to configure the redis connection seperately.
type: keyvalue
# When using memory this defines the maximum size an element can take
maxelementsize: 1000
@ -136,8 +138,10 @@ ratelimit:
period: 60
# The max number of requests a user is allowed to do in the configured time period
limit: 100
# The store where the limit counter for each user is stored. Possible values are "memory" or "redis"
store: memory
# The store where the limit counter for each user is stored.
# Possible values are "keyvalue", "memory" or "redis".
# When choosing "keyvalue" this setting follows the one configured in the "keyvalue" section.
store: keyvalue
files:
# The path where files are stored

View File

@ -314,6 +314,14 @@ func InitConfig() {
return
}
if CacheType.GetString() == "keyvalue" {
CacheType.Set(KeyvalueType.GetString())
}
if RateLimitStore.GetString() == "keyvalue" {
RateLimitStore.Set(KeyvalueType.GetString())
}
log.Printf("Using config file: %s", viper.ConfigFileUsed())
}