1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-20 22:42:59 +03:00

feat: add helper func, cleanup code

This commit is contained in:
Stephanie Hingtgen
2021-10-21 14:54:46 -06:00
parent eb8d0fc81e
commit aee0cc6cae
5 changed files with 55 additions and 89 deletions

View File

@ -173,17 +173,7 @@ func ParseClusterURL(redisURL string) (*ClusterOptions, error) {
// add base URL to the array of addresses
// more addresses may be added through the URL params
h, p, err := net.SplitHostPort(u.Host)
if err != nil {
h = u.Host
}
if h == "" {
h = "localhost"
}
if p == "" {
p = "6379"
}
h, p := getHostPortWithDefaults(u)
o.Addrs = append(o.Addrs, net.JoinHostPort(h, p))
// setup username, password, and other configurations