more configuration options for redis and database

This commit is contained in:
kappa118 2025-02-20 14:13:29 -05:00
parent 3978e60ce9
commit b546c0f89a
3 changed files with 8 additions and 6 deletions

View file

@ -15,15 +15,16 @@ from apps.channels.models import Channel, Stream
# Configure Redis
redis_host = os.environ.get("REDIS_HOST", "redis")
redis_port = int(os.environ.get("REDIS_PORT", 6379))
redis_client = redis.Redis(host=redis_host, port=redis_port, db=0)
redis_db = int(os.environ.get("REDIS_DB", 0))
redis_client = redis.Redis(host=redis_host, port=redis_port, db=redis_db)
def serve_hls_segment(request, stream_id, filename):
# Remove any trailing slashes from the filename. / caused problems.
filename = filename.rstrip('/')
# Construct the file path (e.g., /tmp/hls_4/segment_001.ts)
file_path = os.path.join('/tmp', f'hls_{stream_id}', filename)
if os.path.exists(file_path):
return FileResponse(open(file_path, 'rb'), content_type='video/MP2T')
else:

View file

@ -68,8 +68,8 @@ DATABASES = {
'NAME': os.environ.get('POSTGRES_DB', 'dispatcharr'),
'USER': os.environ.get('POSTGRES_USER', 'dispatch'),
'PASSWORD': os.environ.get('POSTGRES_PASSWORD', 'secret'),
'HOST': 'db',
'PORT': 5432,
'HOST': os.environ.get('POSTGRES_HOST', 'db'),
'PORT': os.environ.get('POSTGRES_PORT', 5432),
}
}
@ -117,4 +117,3 @@ MEDIA_URL = '/media/'
SERVER_IP = "10.0.0.107"

View file

@ -12,6 +12,7 @@ services:
volumes:
- ../:/app
environment:
- POSTGRES_HOST=db
- POSTGRES_DB=dispatcharr
- POSTGRES_USER=dispatch
- POSTGRES_PASSWORD=secret
@ -29,6 +30,7 @@ services:
volumes:
- ../:/app
environment:
- POSTGRES_HOST=db
- POSTGRES_DB=dispatcharr
- POSTGRES_USER=dispatch
- POSTGRES_PASSWORD=secret