Update Celery settings to use dynamic Redis URL extraction
This commit is contained in:
+7
-1
@@ -381,7 +381,13 @@ CIMAR_USERNAME = ""
|
||||
CIMAR_PASSWORD = ""
|
||||
|
||||
# Celery settings
|
||||
REDIS_HOST = os.environ.get("REDIS_HOST", "redis")
|
||||
redis_url_str = os.environ.get("REDIS_URL", "")
|
||||
if redis_url_str.startswith("redis://"):
|
||||
# extract host from redis://host:port/db
|
||||
REDIS_HOST = redis_url_str[8:].split("/")[0].split(":")[0]
|
||||
else:
|
||||
REDIS_HOST = os.environ.get("REDIS_HOST", "127.0.0.1")
|
||||
|
||||
CELERY_BROKER_URL = f"redis://{REDIS_HOST}:6379"
|
||||
CELERY_RESULT_BACKEND = f"redis://{REDIS_HOST}:6379"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user