From ada85168038de4b6c4cfb48f7f8e9153383dfff1 Mon Sep 17 00:00:00 2001 From: Trenton Holmes Date: Thu, 4 Aug 2022 07:43:23 -0700 Subject: [PATCH] Allows the webserver binding address to be configured via the environment --- docs/configuration.rst | 7 +++++++ gunicorn.conf.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index fd68f61cb..dce6b3a83 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -808,6 +808,13 @@ PAPERLESS_WEBSERVER_WORKERS= Defaults to 1. +PAPERLESS_BIND_ADDR= + The IP address the webserver will listen on inside the container. There are + special setups where you may need to configure this value to restrict the + Ip address or interface the webserver listens on. + + Defaults to [::], meaning all interfaces, including IPv6. + PAPERLESS_PORT= The port number the webserver will listen on inside the container. There are special setups where you may need this to avoid collisions with other diff --git a/gunicorn.conf.py b/gunicorn.conf.py index 7193815b3..daebd4bea 100644 --- a/gunicorn.conf.py +++ b/gunicorn.conf.py @@ -1,6 +1,6 @@ import os -bind = f'[::]:{os.getenv("PAPERLESS_PORT", 8000)}' +bind = f'{os.getenv("PAPERLESS_BIND_ADDR", "[::]")}:{os.getenv("PAPERLESS_PORT", 8000)}' workers = int(os.getenv("PAPERLESS_WEBSERVER_WORKERS", 1)) worker_class = "paperless.workers.ConfigurableWorker" timeout = 120