Update Redis sentinel host parsing to handle missing port numbers

This commit is contained in:
Théophile Diot 2024-06-04 18:47:36 +01:00
parent b74df3e719
commit 31addcfb4e
No known key found for this signature in database
GPG key ID: FA995104A0BA376A
2 changed files with 2 additions and 2 deletions

View file

@ -115,7 +115,7 @@ class CLI(ApiCaller):
sentinel_hosts = self.__get_variable("REDIS_SENTINEL_HOSTS", [])
if isinstance(sentinel_hosts, str):
sentinel_hosts = [host.split(":") if ":" in host else host for host in sentinel_hosts.split(" ") if host]
sentinel_hosts = [host.split(":") if ":" in host else (host, "26379") for host in sentinel_hosts.split(" ") if host]
if sentinel_hosts:
sentinel_username = self.__get_variable("REDIS_SENTINEL_USERNAME", None) or None

View file

@ -2151,7 +2151,7 @@ def bans():
sentinel_hosts = db_config.get("REDIS_SENTINEL_HOSTS", [])
if isinstance(sentinel_hosts, str):
sentinel_hosts = [host.split(":") if ":" in host else host for host in sentinel_hosts.split(" ") if host]
sentinel_hosts = [host.split(":") if ":" in host else (host, "26379") for host in sentinel_hosts.split(" ") if host]
if sentinel_hosts:
sentinel_username = db_config.get("REDIS_SENTINEL_USERNAME", None) or None