Skip to content

Commit

Permalink
more info about env variable and sendgrid added to docs, docker-compo…
Browse files Browse the repository at this point in the history
…se.yml files updated
  • Loading branch information
danmash committed Nov 28, 2022
1 parent ae6ac0f commit a17efec
Showing 5 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/sendgrid/utils.py
Original file line number Diff line number Diff line change
@@ -125,8 +125,9 @@ def send_reset_password_email(
sg.send(mail)
except HTTPError as e:
current_app.logger.exception(
"Unable to send reset password email", extra={"error": e.body}
"Unable to send reset password email", extra={"error": e.to_dict}
)
current_app.logger.debug(e.to_dict)
except:
current_app.logger.exception("Unable to send reset password email")

3 changes: 2 additions & 1 deletion docker/docker-compose.m1.yml
Original file line number Diff line number Diff line change
@@ -16,7 +16,8 @@ services:
TEST_DATABASE_PARAMS: Driver={ODBC Driver 17 for SQL Server};Server=tcp:db,1433;Uid=sa;Pwd=Cl1mat3m1nd!;Encrypt=no;TrustServerCertificate=no;Connection Timeout=30;
RECAPTCHA_SECRET_KEY: 6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe
FLASK_APP: "climatemind.py"
SENDGRID_API_KEY: "${SENDGRID_API_KEY}"
SENDGRID_API_KEY: ${SENDGRID_API_KEY}
MAIL_DEFAULT_SENDER: ${MAIL_DEFAULT_SENDER}
command: ["./wait-for-it", "db:1433"]
stdin_open: true
tty: true
3 changes: 2 additions & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -15,7 +15,8 @@ services:
TEST_DATABASE_PARAMS: Driver={ODBC Driver 17 for SQL Server};Server=tcp:db,1433;Uid=sa;Pwd=Cl1mat3m1nd!;Encrypt=no;TrustServerCertificate=no;Connection Timeout=30;
RECAPTCHA_SECRET_KEY: 6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe
FLASK_APP: "climatemind.py"
SENDGRID_API_KEY: "${SENDGRID_API_KEY}"
SENDGRID_API_KEY: ${SENDGRID_API_KEY}
MAIL_DEFAULT_SENDER: ${MAIL_DEFAULT_SENDER}
command: ["./wait-for-it", "db:1433"]
stdin_open: true
tty: true
6 changes: 6 additions & 0 deletions docs/contribute/development/manual-testing.md
Original file line number Diff line number Diff line change
@@ -27,3 +27,9 @@ Your local `climatemind-backend_webapp` container allows you to test web-applica
{% hint style="success" %}
Go to [http://localhost:3000/](http://localhost:3000/) to see your local web app instance.
{% endhint %}

## Send Sendgrid emails from local

To be able to send emails from local machine you have to set two environment variables `SENDGRID_API_KEY` and `MAIL_DEFAULT_SENDER`.
See how to set them [here](work-with-docker.md#use-environment-variables).
If you see `python_http_client.exceptions.BadRequestsError: HTTP Error 400: Bad Request` error check the `e.to_dict` which contain response from SendGrid.
2 changes: 1 addition & 1 deletion docs/contribute/work-with-docker.md
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ After that you will be able to use these variables in the docker-compose files.
services:
api:
environment:
SENDGRID_API_KEY: "${SENDGRID_API_KEY}"
SENDGRID_API_KEY: ${SENDGRID_API_KEY}
```

## Free memory

0 comments on commit a17efec

Please sign in to comment.