chibenwa commented on code in PR #2418: URL: https://github.com/apache/james-project/pull/2418#discussion_r1771106930
########## backends-common/redis/src/main/java/org/apache/james/backends/redis/RedisConfiguration.scala: ########## @@ -42,15 +52,24 @@ object RedisConfiguration { def from(config: Configuration): RedisConfiguration = { val redisConfiguration: RedisConfiguration = config.getString("redis.topology", STANDALONE_TOPOLOGY) match { - case STANDALONE_TOPOLOGY => StandaloneRedisConfiguration.from(config) + case STANDALONE_TOPOLOGY => checkTLS(config, () => TLSStandaloneRedisConfiguration.from(config), () => StandaloneRedisConfiguration.from(config)) case CLUSTER_TOPOLOGY => ClusterRedisConfiguration.from(config) - case MASTER_REPLICA_TOPOLOGY => MasterReplicaRedisConfiguration.from(config) + case MASTER_REPLICA_TOPOLOGY => checkTLS(config, () => TLSMasterReplicaRedisConfiguration.from(config), () => MasterReplicaRedisConfiguration.from(config)) + case SENTINEL_TOPOLOGY => checkTLS(config, () => TLSSentinelRedisConfiguration.from(config), () => SentinelRedisConfiguration.from(config)) case _ => throw new IllegalArgumentException("Invalid topology") } LOGGER.info(s"Configured Redis with: ${redisConfiguration.asString}") redisConfiguration } + + def checkTLS(config: Configuration, f1: () => RedisConfiguration, f2: () => RedisConfiguration): RedisConfiguration = { + if (config.getString(REDIS_URL_PROPERTY_NAME) != null && config.getString(REDIS_URL_PROPERTY_NAME).contains("rediss")) { + f1.apply() + } else { + f2.apply() Review Comment: We can easily remove the duplicated apply code. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org