Browse Source

Allow SMTP configuration via environment variables

This change allows SMTP configuration via email, but users can
still choose to configure the settings directly in local_settings.py
pull/217/head
Tim Freund 6 years ago
parent
commit
415ec58b95
2 changed files with 14 additions and 1 deletions
  1. +7
    -1
      README.md
  2. +7
    -0
      hc/settings.py

+ 7
- 1
README.md View File

@ -101,6 +101,11 @@ Configurations settings loaded from environment variables:
| [DB_CONN_MAX_AGE](https://docs.djangoproject.com/en/2.1/ref/settings/#conn-max-age) | `0` | [DB_CONN_MAX_AGE](https://docs.djangoproject.com/en/2.1/ref/settings/#conn-max-age) | `0`
| DB_SSLMODE | `"prefer"` | PostgreSQL-specific, [details](https://blog.github.com/2018-10-21-october21-incident-report/) | DB_SSLMODE | `"prefer"` | PostgreSQL-specific, [details](https://blog.github.com/2018-10-21-october21-incident-report/)
| DB_TARGET_SESSION_ATTRS | `"read-write"` | PostgreSQL-specific, [details](https://www.postgresql.org/docs/10/static/libpq-connect.html#LIBPQ-CONNECT-TARGET-SESSION-ATTRS) | DB_TARGET_SESSION_ATTRS | `"read-write"` | PostgreSQL-specific, [details](https://www.postgresql.org/docs/10/static/libpq-connect.html#LIBPQ-CONNECT-TARGET-SESSION-ATTRS)
| EMAIL_HOST | `""` *(empty string)*
| EMAIL_PORT | `"587"`
| EMAIL_HOST_USER | `""` *(empty string)*
| EMAIL_HOST_PASSWORD | `""` *(empty string)*
| EMAIL_USE_TLS | `"True"`
| SITE_ROOT | `"http://localhost:8000"` | SITE_ROOT | `"http://localhost:8000"`
| SITE_NAME | `"Mychecks"` | SITE_NAME | `"Mychecks"`
| MASTER_BADGE_LABEL | `"Mychecks"` | MASTER_BADGE_LABEL | `"Mychecks"`
@ -175,7 +180,8 @@ DATABASES = {
## Sending Emails ## Sending Emails
healthchecks must be able to send email messages, so it can send out login healthchecks must be able to send email messages, so it can send out login
links and alerts to users. Put your SMTP server configuration in
links and alerts to users. Environment variables can be used to configure
SMTP settings, or your may put your SMTP server configuration in
`hc/local_settings.py` like so: `hc/local_settings.py` like so:
```python ```python


+ 7
- 0
hc/settings.py View File

@ -158,6 +158,13 @@ COMPRESS_CSS_HASHING_METHOD = "content"
DISCORD_CLIENT_ID = os.getenv("DISCORD_CLIENT_ID") DISCORD_CLIENT_ID = os.getenv("DISCORD_CLIENT_ID")
DISCORD_CLIENT_SECRET = os.getenv("DISCORD_CLIENT_SECRET") DISCORD_CLIENT_SECRET = os.getenv("DISCORD_CLIENT_SECRET")
# Email integration
EMAIL_HOST = os.getenv("EMAIL_HOST", "")
EMAIL_PORT = envint("EMAIL_PORT", "587")
EMAIL_HOST_USER = os.getenv("EMAIL_HOST_USER", "")
EMAIL_HOST_PASSWORD = os.getenv("EMAIL_HOST_PASSWORD", "")
EMAIL_USE_TLS = envbool("EMAIL_USE_TLS", "True")
# Slack integration # Slack integration
SLACK_CLIENT_ID = os.getenv("SLACK_CLIENT_ID") SLACK_CLIENT_ID = os.getenv("SLACK_CLIENT_ID")
SLACK_CLIENT_SECRET = os.getenv("SLACK_CLIENT_SECRET") SLACK_CLIENT_SECRET = os.getenv("SLACK_CLIENT_SECRET")


Loading…
Cancel
Save