Skip to content

Commit

Permalink
passing SERVER_NAME as env variable, try catching email sends
Browse files Browse the repository at this point in the history
  • Loading branch information
dnaaun committed Jul 12, 2020
1 parent 9a291b0 commit ff3feba
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
REDIS_HOST=redis
REDIS_PORT=6739
SERVER_NAME=www.openframing.org

# These need to be set appropriately for emailing to work. One
# can pass them from the environment, more "directly" as well.
SENDGRID_API_KEY=
SENDGRID_FROM_EMAIL=
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ services:
- REDIS_PORT
- SENDGRID_API_KEY
- SENDGRID_FROM_EMAIL
- SERVER_NAME
nginx:
build: ./services/nginx
restart: always
Expand Down Expand Up @@ -49,6 +50,7 @@ services:
- REDIS_PORT
- SENDGRID_API_KEY
- SENDGRID_FROM_EMAIL
- SERVER_NAME
# We need to pass them here, in addition to `command` above, because the
# worker will import settings.py, which needs them to be set.

Expand All @@ -66,6 +68,8 @@ services:
- REDIS_PORT
- SENDGRID_API_KEY
- SENDGRID_FROM_EMAIL
- SERVER_NAME
# We need to pass them here, in addition to `command` above, because the
# We need to pass them here, in addition to `command` above, because the
# worker will import settings.py, which needs them to be set.

Expand Down
7 changes: 6 additions & 1 deletion services/web/backend/flask_app/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,4 +222,9 @@ def send_email(
)

for sg_client in self._sg_clients:
sg_client.send(message)
try:
sg_client.send(message)
except Exception as e:
logger.critical("Coudn't send email: " + str(vars(e)))


0 comments on commit ff3feba

Please sign in to comment.