Skip to content

Commit a119920

Browse files
0.10.6: redis sentinel support (proto + Redisson config); submodule bump
1 parent 15f70fc commit a119920

4 files changed

Lines changed: 21 additions & 5 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ dependencies {
2424
}
2525

2626
allprojects {
27-
project.version = '0.10.5'
27+
project.version = '0.10.6'
2828
}
2929

3030
subprojects {

spellsource-private/src/secrets

spellsource-protos/src/main/proto/hiddenswitch.proto

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,15 @@ message ServerConfiguration {
3737
string user = 3;
3838
}
3939

40+
message SentinelServers {
41+
repeated string sentinelAddresses = 1;
42+
string masterName = 2;
43+
}
44+
4045
oneof connection {
4146
HostPortUser hostPortUser = 1;
4247
string uri = 2;
48+
SentinelServers sentinelServers = 3;
4349
}
4450
}
4551

spellsource-server/src/main/java/com/hiddenswitch/framework/Environment.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,20 @@ public class Environment {
9898
}
9999

100100
private static RedissonClient redissonClientConstructor(Vertx vertx) {
101-
var configuration = getConfiguration();
101+
var redisConf = getConfiguration().getRedis();
102102
var config = new Config();
103-
// todo: this should probably come out of the configuration, shouldn't it?
104-
config.useSingleServer().setAddress(configuration.getRedis().getUri());
103+
switch (redisConf.getConnectionCase()) {
104+
case SENTINELSERVERS -> {
105+
var sentinel = redisConf.getSentinelServers();
106+
var sentinelConf = config.useSentinelServers().setMasterName(sentinel.getMasterName());
107+
sentinel.getSentinelAddressesList().forEach(sentinelConf::addSentinelAddress);
108+
}
109+
case HOSTPORTUSER -> {
110+
var hpu = redisConf.getHostPortUser();
111+
config.useSingleServer().setAddress("redis://" + hpu.getHost() + ":" + hpu.getPort());
112+
}
113+
case URI, CONNECTION_NOT_SET -> config.useSingleServer().setAddress(redisConf.getUri());
114+
}
105115
return Redisson.create(config);
106116
}
107117

0 commit comments

Comments
 (0)