Skip to content

Commit

Permalink
Added a parameter to list administrators who will receive 500 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
elias-boulharts authored and EliasBoulharts committed May 29, 2024
1 parent de1b239 commit d41c1df
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 2.6.1 XXXX-XX-XX

## Enhancement

- Add parameter to define list of administrators to which to send 500 errors via SMTP
- Add parameters to login into SMTP server

# 2.6.0 2024-05-22

## Fix
Expand Down
8 changes: 8 additions & 0 deletions Squest/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@
'class': 'logging.StreamHandler',
'formatter': 'verbose',
},
"mail_admins": {
"level": "ERROR",
"class": "django.utils.log.AdminEmailHandler",
"include_html": True,
},
},
'loggers': {
'': {
Expand Down Expand Up @@ -311,15 +316,18 @@
# -----------------------------------------
# Squest email config
# -----------------------------------------
ADMINS = [("", element) for element in os.environ.get('SQUEST_ADMINS', '').split(',') if element]
SQUEST_HOST = os.environ.get('SQUEST_HOST', "http://squest.domain.local")
SQUEST_EMAIL_HOST = os.environ.get('SQUEST_EMAIL_HOST', "[email protected]")
SERVER_EMAIL = SQUEST_EMAIL_HOST
SQUEST_EMAIL_NOTIFICATION_ENABLED = str_to_bool(os.environ.get('SQUEST_EMAIL_NOTIFICATION_ENABLED', False))
EMAIL_HOST = os.environ.get('EMAIL_HOST', 'localhost')
EMAIL_PORT = os.environ.get('EMAIL_PORT', 25)
EMAIL_HOST_USER= os.environ.get('EMAIL_HOST_USER', None)
EMAIL_HOST_PASSWORD= os.environ.get('EMAIL_HOST_PASSWORD', None)
EMAIL_USE_SSL= os.environ.get('EMAIL_USE_SSL', False)

print(f"ADMINS: {ADMINS}")
print(f"SQUEST_HOST: {SQUEST_HOST}")
print(f"SQUEST_EMAIL_HOST: {SQUEST_EMAIL_HOST}")
print(f"SQUEST_EMAIL_NOTIFICATION_ENABLED: {SQUEST_EMAIL_NOTIFICATION_ENABLED}")
Expand Down
11 changes: 11 additions & 0 deletions docs/configuration/squest_settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,17 @@ Address of the Squest portal instance. Used in email templates and in metadata s

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

### SQUEST_ADMINS

**Default:** `''`

A list of all the email who get code error notifications. When DEBUG=False.
Example:

```text
[email protected],[email protected]
```

### SQUEST_EMAIL_NOTIFICATION_ENABLED

**Default:** Based on `DEBUG` value by default
Expand Down

0 comments on commit d41c1df

Please sign in to comment.