problem: tries to connect to Redis even if specified as disabled

This commit is contained in:
Igor Artamonov
2020-06-29 21:49:01 -04:00
parent 03b6d6472c
commit 04958784ec
3 changed files with 33 additions and 12 deletions

View File

@@ -35,19 +35,22 @@ class CacheConfigReader : YamlConfigReader(), ConfigReader<CacheConfig> {
val config = CacheConfig()
getMapping(node, "redis")?.let { node ->
val redis = CacheConfig.Redis()
getValueAsString(node, "host")?.let {
redis.host = it
val enabled = getValueAsBool(node, "enabled") ?: true
if (enabled) {
getValueAsString(node, "host")?.let {
redis.host = it
}
getValueAsInt(node, "port")?.let {
redis.port = it
}
getValueAsInt(node, "db")?.let {
redis.db = it
}
getValueAsString(node, "password")?.let {
redis.password = it
}
config.redis = redis
}
getValueAsInt(node, "port")?.let {
redis.port = it
}
getValueAsInt(node, "db")?.let {
redis.db = it
}
getValueAsString(node, "password")?.let {
redis.password = it
}
config.redis = redis
}
if (config.redis == null) {
return null