"""Gunicorn configuration for Squid Manager. Usage: gunicorn -c gunicorn_config.py wsgi:app All values can be overridden via environment variables: SQUIDMGR_HOST bind address (default: 0.0.0.0) SQUIDMGR_PORT bind port (default: 5200) SQUIDMGR_WORKERS worker count (default: 2) SQUIDMGR_TIMEOUT worker timeout (default: 120) """ import multiprocessing import os _host = os.environ.get("SQUIDMGR_HOST", "0.0.0.0") _port = os.environ.get("SQUIDMGR_PORT", "5200") _workers = int(os.environ.get("SQUIDMGR_WORKERS", 2)) _timeout = int(os.environ.get("SQUIDMGR_TIMEOUT", 120)) bind = f"{_host}:{_port}" workers = _workers timeout = _timeout worker_class = "sync" # Logging accesslog = "-" # stdout → journald errorlog = "-" # stderr → journald loglevel = "info" # Preload app to share memory & fail fast on import errors preload_app = True # PID file (for health-check scripts) pidfile = os.path.join(os.path.dirname(os.path.abspath(__file__)), "instance", "gunicorn.pid")