refactor: externalize Redis and Celery configuration via environment variables

Replace hardcoded localhost:6379 values throughout codebase with environment-based configuration. Add REDIS_PORT support and allow REDIS_URL override for external Redis services. Configure Celery broker/result backend to use Redis settings with environment variable overrides.

Closes #762
This commit is contained in:
SergeantPanda 2025-12-18 16:54:59 -06:00
parent e78c18c473
commit de31826137
7 changed files with 32 additions and 11 deletions

View file

@ -37,7 +37,9 @@ def stream_view(request, channel_uuid):
"""
try:
redis_host = getattr(settings, "REDIS_HOST", "localhost")
redis_client = redis.Redis(host=settings.REDIS_HOST, port=6379, db=int(getattr(settings, "REDIS_DB", "0")))
redis_port = int(getattr(settings, "REDIS_PORT", 6379))
redis_db = int(getattr(settings, "REDIS_DB", "0"))
redis_client = redis.Redis(host=redis_host, port=redis_port, db=redis_db)
# Retrieve the channel by the provided stream_id.
channel = Channel.objects.get(uuid=channel_uuid)