Skip to content

Commit

Permalink
added email settings and updated email task to check if email notific…
Browse files Browse the repository at this point in the history
…ation sending is disabled
  • Loading branch information
nirmeen committed Nov 9, 2023
1 parent fc3ebed commit c6dbcee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions elixir_daisy/settings_local.template.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@
# KEYCLOAK_USER = 'your service user for daisy'
# KEYCLOAK_PASS = 'the password for the service user'

# Email related setting
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = ""
EMAIL_PORT = 25
EMAIL_SENDER = ""

# Celery beat setting to schedule tasks on docker creation
CELERY_BEAT_SCHEDULE = {
"clean-accesses-every-day": {
Expand Down
6 changes: 6 additions & 0 deletions notification/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ def send_notifications_for_user_upcoming_events(
only_one_day: If true send the notifications of the execution date only.
"""

if settings.NOTIFICATIONS_DISABLED:
logger.info(
"No notifications sent. Notifications sending is disabled in settings.py"
)
return

logger.info("Sending notification for user upcoming events")

if not execution_date:
Expand Down

0 comments on commit c6dbcee

Please sign in to comment.