Skip to content

Commit

Permalink
fix: Add port number to internal addresses
Browse files Browse the repository at this point in the history
Changelog: Title
Ticket: MC-6522

Signed-off-by: Alf-Rune Siqveland <alf.rune@northern.tech>
  • Loading branch information
alfrunes committed May 13, 2024
1 parent a195c1d commit 98924c4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions redis/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ func ClientFromConnectionString(
// Allow host to be a comma-separated list of hosts.
if idx := strings.LastIndexByte(redisurl.Host, ','); idx > 0 {
nodeAddrs := strings.Split(redisurl.Host[:idx], ",")
for i := range nodeAddrs {
const redisPort = ":6379"
idx := strings.LastIndex(nodeAddrs[i], ":")
if idx < 0 {
nodeAddrs[i] = nodeAddrs[i] + redisPort
}
}
q["addr"] = nodeAddrs
redisurl.RawQuery = q.Encode()
redisurl.Host = redisurl.Host[idx+1:]
Expand Down

0 comments on commit 98924c4

Please sign in to comment.