36 lines
819 B
Python
36 lines
819 B
Python
"""Gunicorn configuration for YouTube Web Server."""
|
|
|
|
import os
|
|
|
|
# Server binding
|
|
bind = f"0.0.0.0:{os.environ.get('PORT', 4096)}"
|
|
|
|
# Worker configuration - use gthread for threading-based SocketIO
|
|
worker_class = "gthread"
|
|
workers = 1
|
|
|
|
# Thread configuration
|
|
threads = 4
|
|
|
|
# Timeout configuration
|
|
timeout = 120
|
|
graceful_timeout = 60
|
|
|
|
# Logging - use stdout/stderr in Docker, files locally
|
|
import os
|
|
|
|
if os.environ.get('DOCKER'):
|
|
accesslog = "-"
|
|
errorlog = "-"
|
|
loglevel = "info"
|
|
else:
|
|
accesslog = "/home/user/repos/youtube-cli/web/server/gunicorn-access.log"
|
|
errorlog = "/home/user/repos/youtube-cli/web/server/gunicorn-error.log"
|
|
loglevel = "debug"
|
|
|
|
# Process naming
|
|
proc_name = "youtube-web-server"
|
|
|
|
# Preload app - disabled as it causes yt-dlp C extension issues after fork
|
|
preload_app = False
|