Update Celery settings to use dynamic Redis URL extraction

This commit is contained in:
Ross
2026-06-17 22:23:04 +01:00
parent 24d9594446
commit 0110a6c4d4
+7 -1
View File
@@ -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"