From efbda733eda107a74026e6fff55ec43bde72fc60 Mon Sep 17 00:00:00 2001 From: Aryaman Date: Wed, 22 Mar 2023 21:33:58 +0530 Subject: [PATCH] [feature] Added default EMAIL_TIMEOUT #257 Closes #257 --- .../configuration/django/custom_django_settings.example.py | 1 + docs/ENV.md | 6 ++++++ images/common/openwisp/settings.py | 1 + images/openwisp_base/Dockerfile | 1 + 4 files changed, 9 insertions(+) diff --git a/customization/configuration/django/custom_django_settings.example.py b/customization/configuration/django/custom_django_settings.example.py index e703eb7e..1c40f743 100644 --- a/customization/configuration/django/custom_django_settings.example.py +++ b/customization/configuration/django/custom_django_settings.example.py @@ -6,3 +6,4 @@ # EMAIL_HOST_PASSWORD = # EMAIL_PORT = # EMAIL_USE_TLS = +# EMAIL_TIMEOUT = diff --git a/docs/ENV.md b/docs/ENV.md index 7fa9f0d7..2c5cd139 100644 --- a/docs/ENV.md +++ b/docs/ENV.md @@ -442,6 +442,12 @@ Any OpenWISP Configuration of type `string`. `int`, `bool` or `json` is supporte - **Valid Values:** True | False - **Default:** False +### `EMAIL_TIMEOUT` + +- **Explanation:** Specifies a timeout in seconds used by Django for blocking operations like the connection attempt. +- **Valid Values:** INTEGER +- **Default:** 10 + ### `POSTFIX_ALLOWED_SENDER_DOMAINS` - **Explanation:** Due to in-built spam protection in Postfix you will need to specify sender domains. diff --git a/images/common/openwisp/settings.py b/images/common/openwisp/settings.py index a74d60f9..a4e32a0f 100644 --- a/images/common/openwisp/settings.py +++ b/images/common/openwisp/settings.py @@ -265,6 +265,7 @@ EMAIL_HOST_USER = os.environ['EMAIL_HOST_USER'] EMAIL_HOST_PASSWORD = os.environ['EMAIL_HOST_PASSWORD'] EMAIL_USE_TLS = env_bool(os.environ['EMAIL_HOST_TLS']) +EMAIL_TIMEOUT = os.environ['EMAIL_TIMEOUT'] # Logging # http://docs.djangoproject.com/en/dev/topics/logging diff --git a/images/openwisp_base/Dockerfile b/images/openwisp_base/Dockerfile index 7a811462..2d0d5b94 100644 --- a/images/openwisp_base/Dockerfile +++ b/images/openwisp_base/Dockerfile @@ -118,6 +118,7 @@ ENV DASHBOARD_APP_SERVICE=dashboard \ EMAIL_HOST_USER="" \ EMAIL_HOST_PASSWORD="" \ EMAIL_HOST_TLS=False \ + EMAIL_TIMEOUT=10 \ EMAIL_DJANGO_DEFAULT=example@example.org \ DJANGO_LOG_LEVEL=ERROR \ DJANGO_LANGUAGE_CODE=en-gb \