Make gunicorn IPv6 conditional

Only listen on [::]:80 in case SUBNET6 is defined, otherwise do the normal :80
main
Chris Schäpers 3 years ago committed by Alexander Graf
parent 9f6848110a
commit 35331a4295
No known key found for this signature in database
GPG Key ID: B8A9DC143E075629

@ -52,10 +52,15 @@ def test_DNS():
test_DNS() test_DNS()
bind_addr = ":80"
if os.environ.get("SUBNET6") is not None:
# If SUBNET6 is defined, gunicorn must listen on IPv6 as well as IPv4
bind_addr = "[::]:80"
start_command=" ".join([ start_command=" ".join([
"gunicorn", "gunicorn",
f"--threads {str(os.cpu_count())}", f"--threads {str(os.cpu_count())}",
"-b [::]:80", "-b", bind_addr,
"--logger-class mailu.Logger", "--logger-class mailu.Logger",
"--worker-tmp-dir /dev/shm", "--worker-tmp-dir /dev/shm",
"--access-logfile -" if (log.root.level<=log.INFO) else "", "--access-logfile -" if (log.root.level<=log.INFO) else "",

Loading…
Cancel
Save