Skip to content

Commit

Permalink
fix: add sentinel pw to transport options
Browse files Browse the repository at this point in the history
  • Loading branch information
nsantacruz committed Mar 5, 2024
1 parent 798b23c commit 316da87
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/celery_setup/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# Either define SENTINEL_HEADLESS_URL if using sentinel or REDIS_URL for a simple redis instance
sentinel_url = os.getenv('SENTINEL_HEADLESS_URL')
sentinel_transport_opts = json.loads(os.getenv('SENTINEL_TRANSPORT_OPTS', '{}'))
sentinel_password = os.getenv('SENTINEL_PASSWORD')
redis_url = os.getenv('REDIS_URL')
redis_password = os.getenv('REDIS_PASSWORD')

Expand All @@ -36,7 +37,7 @@ def add_password_to_url(url, password):
broker_url = add_db_num_to_url(joined_address, broker_db_num)
result_backend = add_db_num_to_url(joined_address, result_backend_db_num)
result_backend_transport_options = sentinel_transport_opts
broker_transport_options = sentinel_transport_opts
broker_transport_options = {**sentinel_transport_opts, "sentinel_kwargs": {"password": sentinel_password}}
else:
redis_url = add_password_to_url(f"{redis_url}:{redis_port}", redis_password)
broker_url = add_db_num_to_url(redis_url, broker_db_num)
Expand Down

0 comments on commit 316da87

Please sign in to comment.