Skip to content

Commit 699c5e5

Browse files
rlunarRoberto Luna Rojas
authored andcommitted
Customize TLS connection parameter for DB remote caching
--------- Co-authored-by: Roberto Luna Rojas <rberoj+sns@amazon.com>
1 parent 213d89f commit 699c5e5

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

wrapper/src/main/java/software/amazon/jdbc/plugin/cache/CacheConnection.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,18 @@ public class CacheConnection {
5151
null,
5252
"The cache read-only server endpoint address.");
5353

54+
protected static final AwsWrapperProperty CACHE_USE_SSL =
55+
new AwsWrapperProperty(
56+
"cacheUseSSL",
57+
"true",
58+
"Whether to use SSL for cache connections.");
59+
60+
private final boolean useSSL;
61+
5462
public CacheConnection(final Properties properties) {
5563
this.cacheRwServerAddr = CACHE_RW_ENDPOINT_ADDR.getString(properties);
5664
this.cacheRoServerAddr = CACHE_RO_ENDPOINT_ADDR.getString(properties);
65+
this.useSSL = Boolean.parseBoolean(CACHE_USE_SSL.getString(properties));
5766
}
5867

5968
/* Here we check if we need to initialise connection pool for read or write to cache.
@@ -96,7 +105,7 @@ private void createConnectionPool(boolean isRead) {
96105
String[] hostnameAndPort = serverAddr.split(":");
97106
RedisURI redisUriCluster = RedisURI.Builder.redis(hostnameAndPort[0])
98107
.withPort(Integer.parseInt(hostnameAndPort[1]))
99-
.withSsl(true).withVerifyPeer(false).build();
108+
.withSsl(useSSL).withVerifyPeer(false).build();
100109

101110
RedisClient client = RedisClient.create(resources, redisUriCluster);
102111
GenericObjectPool<StatefulRedisConnection<byte[], byte[]>> pool =

0 commit comments

Comments
 (0)