Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/config/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,18 @@ def get_redis_config():
Returns:
dict: Redis configuration parameters
"""
# Treat empty string as None — Redis server without a password rejects
# AUTH when a non-None password is sent (redis-py sends AUTH even for ""),
# raising: "AUTH <password> called without any password configured".
redis_password = os.getenv("REDIS_PASSWORD", None)
if redis_password is not None and redis_password.strip() == "":
redis_password = None

return {
"host": os.getenv("REDIS_HOST", "localhost"),
"port": int(os.getenv("REDIS_PORT", 6379)),
"db": int(os.getenv("REDIS_DB", 0)),
"password": os.getenv("REDIS_PASSWORD", None),
"password": redis_password,
"ssl": os.getenv("REDIS_SSL", "false").lower() == "true",
"key_prefix": os.getenv("REDIS_KEY_PREFIX", "a2a:"),
"default_ttl": int(os.getenv("REDIS_TTL", 3600)),
Expand Down
9 changes: 8 additions & 1 deletion src/services/adk/mcp_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,18 @@ def __init__(self):
f"Redis configuration: host={redis_config['host']}, port={redis_config['port']}, db={redis_config['db']}"
)

# Defensive: ensure empty string password becomes None to avoid
# "AUTH called without any password configured" error on Redis servers
# that run without AUTH (common in community Docker setups).
redis_password = redis_config.get("password")
if redis_password is not None and str(redis_password).strip() == "":
redis_password = None

self.redis = redis.Redis(
host=redis_config["host"],
port=redis_config["port"],
db=redis_config["db"],
password=redis_config["password"],
password=redis_password,
ssl=redis_config["ssl"],
decode_responses=False, # We need bytes for pickle
)
Expand Down