Skip to content

Commit d41c1df

Browse files
elias-boulhartsEliasBoulharts
elias-boulharts
authored andcommitted
Added a parameter to list administrators who will receive 500 errors
1 parent de1b239 commit d41c1df

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# 2.6.1 XXXX-XX-XX
2+
3+
## Enhancement
4+
5+
- Add parameter to define list of administrators to which to send 500 errors via SMTP
6+
- Add parameters to login into SMTP server
7+
18
# 2.6.0 2024-05-22
29

310
## Fix

Squest/settings.py

+8
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@
280280
'class': 'logging.StreamHandler',
281281
'formatter': 'verbose',
282282
},
283+
"mail_admins": {
284+
"level": "ERROR",
285+
"class": "django.utils.log.AdminEmailHandler",
286+
"include_html": True,
287+
},
283288
},
284289
'loggers': {
285290
'': {
@@ -311,15 +316,18 @@
311316
# -----------------------------------------
312317
# Squest email config
313318
# -----------------------------------------
319+
ADMINS = [("", element) for element in os.environ.get('SQUEST_ADMINS', '').split(',') if element]
314320
SQUEST_HOST = os.environ.get('SQUEST_HOST', "http://squest.domain.local")
315321
SQUEST_EMAIL_HOST = os.environ.get('SQUEST_EMAIL_HOST', "[email protected]")
322+
SERVER_EMAIL = SQUEST_EMAIL_HOST
316323
SQUEST_EMAIL_NOTIFICATION_ENABLED = str_to_bool(os.environ.get('SQUEST_EMAIL_NOTIFICATION_ENABLED', False))
317324
EMAIL_HOST = os.environ.get('EMAIL_HOST', 'localhost')
318325
EMAIL_PORT = os.environ.get('EMAIL_PORT', 25)
319326
EMAIL_HOST_USER= os.environ.get('EMAIL_HOST_USER', None)
320327
EMAIL_HOST_PASSWORD= os.environ.get('EMAIL_HOST_PASSWORD', None)
321328
EMAIL_USE_SSL= os.environ.get('EMAIL_USE_SSL', False)
322329

330+
print(f"ADMINS: {ADMINS}")
323331
print(f"SQUEST_HOST: {SQUEST_HOST}")
324332
print(f"SQUEST_EMAIL_HOST: {SQUEST_EMAIL_HOST}")
325333
print(f"SQUEST_EMAIL_NOTIFICATION_ENABLED: {SQUEST_EMAIL_NOTIFICATION_ENABLED}")

docs/configuration/squest_settings.md

+11
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,17 @@ Address of the Squest portal instance. Used in email templates and in metadata s
185185

186186
Domain name used as email sender. E.g: "[email protected]".
187187

188+
### SQUEST_ADMINS
189+
190+
**Default:** `''`
191+
192+
A list of all the email who get code error notifications. When DEBUG=False.
193+
Example:
194+
195+
```text
196+
197+
```
198+
188199
### SQUEST_EMAIL_NOTIFICATION_ENABLED
189200

190201
**Default:** Based on `DEBUG` value by default

0 commit comments

Comments
 (0)