Rewrite generation of gunicorn cmdline

main
Alexander Graf 1 year ago
parent 7cc5d1f756
commit 1ad1d8d95d
No known key found for this signature in database
GPG Key ID: B8A9DC143E075629

@ -52,20 +52,21 @@ def test_DNS():
test_DNS() test_DNS()
bind_addr = ":80" cmdline = [
if os.environ.get("SUBNET6") is not None: "gunicorn",
# If SUBNET6 is defined, gunicorn must listen on IPv6 as well as IPv4 "--threads", f"{os.cpu_count()}",
bind_addr = "[::]:80" # If SUBNET6 is defined, gunicorn must listen on IPv6 as well as IPv4
"-b", f"{'[::]' if os.environ.get('SUBNET6') else ''}:80",
start_command=" ".join([
"gunicorn",
f"--threads {str(os.cpu_count())}",
"-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 "", "--error-logfile", "-",
"--error-logfile -", "--preload"
"--preload", ]
"'mailu:create_app()'"])
os.system(start_command) # logging
if log.root.level <= log.INFO:
cmdline.extend(["--access-logfile", "-"])
cmdline.append("'mailu:create_app()'")
os.system(" ".join(cmdline))

Loading…
Cancel
Save