Skip to content

Commit

Permalink
fix(spring): Added checks to avoid overriding URI parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
jruaux committed Sep 5, 2023
1 parent 7b5960e commit ab3d7e3
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,24 @@ public class RedisModulesAutoConfiguration {
RedisURI redisURI(RedisProperties properties) {
RedisURI uri = StringUtils.hasLength(properties.getUrl()) ? RedisURI.create(properties.getUrl())
: RedisURI.create(properties.getHost(), properties.getPort());
uri.setClientName(properties.getClientName());
uri.setDatabase(properties.getDatabase());
if (StringUtils.hasLength(properties.getClientName())) {
uri.setClientName(properties.getClientName());
}
if (properties.getDatabase() > 0) {
uri.setDatabase(properties.getDatabase());
}
if (StringUtils.hasLength(properties.getPassword())) {
uri.setPassword(properties.getPassword());
}
uri.setSsl(properties.isSsl());
if (properties.isSsl()) {
uri.setSsl(properties.isSsl());
}
if (properties.getTimeout() != null) {
uri.setTimeout(properties.getTimeout());
}
uri.setUsername(properties.getUsername());
if (StringUtils.hasLength(properties.getUsername())) {
uri.setUsername(properties.getUsername());
}
return uri;
}

Expand Down

0 comments on commit ab3d7e3

Please sign in to comment.