diff --git a/CONFIGURATION.md b/CONFIGURATION.md index 20a3d574..38924abc 100644 --- a/CONFIGURATION.md +++ b/CONFIGURATION.md @@ -77,14 +77,16 @@ Users of nginx/apache must ensure to have matching CORS configurations. * `PAGINATION_DEFAULT_PAGE_SIZE`: the default page size if no query param (`page_size`) is given (default: `100`) * `PAGINATION_MAX_PAGE_SIZE`: the max value of the page size query param (`page_size`) (default: `1000`) -## Email error handler -* `ENABLE_ADMIN_EMAIL_LOGGING`: enable Django to send email to admins on errors (default: `False`) +## Email * `SERVER_EMAIL`: the email address that error messages come from * `EMAIL_HOST`: the host to use for sending email (default: `localhost`) * `EMAIL_PORT`: port to use for the SMTP server (default: `25`) * `EMAIL_HOST_USER`: username for the SMTP server(default: "") * `EMAIL_HOST_PASSWORD`: password for the SMTP server user (default: "") * `EMAIL_USE_TLS`: whether to use an implicit TLS (secure) connection when talking to the SMTP server (default: `False`) -* `ADMINS`: list of people who will get code error notifications. Items in the list should follow this example: `Test Example ,Test2 ` If either `EMAIL_HOST_USER` or `EMAIL_HOST_PASSWORD` is empty, Django won't attempt authentication. + +## Email error handler +* `ENABLE_ADMIN_EMAIL_LOGGING`: enable Django to send email to admins on errors (default: `False`) +* `ADMINS`: list of people who will get code error notifications. Items in the list should follow this example: `Test Example ,Test2 ` diff --git a/document_merge_service/settings.py b/document_merge_service/settings.py index 25a6d6a9..9186ef72 100644 --- a/document_merge_service/settings.py +++ b/document_merge_service/settings.py @@ -250,11 +250,13 @@ def parse_admins(admins): URL_PREFIX = env.str("URL_PREFIX", default="") # Email settings +SERVER_EMAIL = env.str("SERVER_EMAIL", default="root@localhost") +EMAIL_HOST = env.str("EMAIL_HOST", default="localhost") +EMAIL_PORT = env.int("EMAIL_PORT", default=25) +EMAIL_HOST_USER = env.str("EMAIL_HOST_USER", default="") +EMAIL_HOST_PASSWORD = env.str("EMAIL_HOST_PASSWORD", default="") +EMAIL_USE_TLS = env.bool("EMAIL_USE_TLS", default=False) + +# Email error handler if ENABLE_ADMIN_EMAIL_LOGGING: # pragma: no cover LOGGING["loggers"]["django"]["handlers"].append("mail_admins") # type: ignore - SERVER_EMAIL = env.str("SERVER_EMAIL", default="root@localhost") - EMAIL_HOST = env.str("EMAIL_HOST", default="localhost") - EMAIL_PORT = env.int("EMAIL_PORT", default=25) - EMAIL_HOST_USER = env.str("EMAIL_HOST_USER", default="") - EMAIL_HOST_PASSWORD = env.str("EMAIL_HOST_PASSWORD", default="") - EMAIL_USE_TLS = env.bool("EMAIL_USE_TLS", default=False)