mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
allow setting REDIS_CLUSTER_NODES in .env
This commit is contained in:
parent
a1f0169fc1
commit
9225d31776
1 changed files with 9 additions and 1 deletions
|
@ -8,6 +8,7 @@
|
||||||
# Thank you users! We ❤️ you! - Krrish & Ishaan
|
# Thank you users! We ❤️ you! - Krrish & Ishaan
|
||||||
|
|
||||||
import inspect
|
import inspect
|
||||||
|
import json
|
||||||
|
|
||||||
# s/o [@Frank Colson](https://www.linkedin.com/in/frank-colson-422b9b183/) for this redis implementation
|
# s/o [@Frank Colson](https://www.linkedin.com/in/frank-colson-422b9b183/) for this redis implementation
|
||||||
import os
|
import os
|
||||||
|
@ -142,7 +143,14 @@ def get_redis_client(**env_overrides):
|
||||||
|
|
||||||
return redis.Redis.from_url(**url_kwargs)
|
return redis.Redis.from_url(**url_kwargs)
|
||||||
|
|
||||||
if "startup_nodes" in redis_kwargs:
|
if (
|
||||||
|
"startup_nodes" in redis_kwargs
|
||||||
|
or litellm.get_secret("REDIS_CLUSTER_NODES") is not None
|
||||||
|
):
|
||||||
|
_redis_cluster_nodes_in_env = litellm.get_secret("REDIS_CLUSTER_NODES")
|
||||||
|
if _redis_cluster_nodes_in_env is not None:
|
||||||
|
redis_kwargs["startup_nodes"] = json.loads(_redis_cluster_nodes_in_env)
|
||||||
|
|
||||||
from redis.cluster import ClusterNode
|
from redis.cluster import ClusterNode
|
||||||
|
|
||||||
args = _get_redis_cluster_kwargs()
|
args = _get_redis_cluster_kwargs()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue