Skip to content

Commit

Permalink
Use mozmail.com based on env var
Browse files Browse the repository at this point in the history
  • Loading branch information
say-yawn committed Aug 5, 2021
1 parent e6cbcce commit 53c061e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .env-dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ SECRET_KEY=unsafe-secret-key-for-dev-envs
ADMIN_ENABLED=
DEBUG=True
DJANGO_INTERNAL_IPS=127.0.0.1, localhost
ADDITIONAL_DOMAINS="mozmail.com,"
TEST_MOZMAIL=True
ADDITIONAL_DOMAINS="mozmail.com,environment-domain.com"
SENTRY_DSN=""
SERVE_ADDON="private_relay.zip"
AWS_REGION="us-east-1"
Expand Down
1 change: 0 additions & 1 deletion emails/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

DOMAIN_DEFAULT = get_email_domain_from_settings()
DOMAIN_CHOICES = [(item, item) for item in settings.ADDITIONAL_DOMAINS]
DOMAIN_CHOICES.append((DOMAIN_DEFAULT, DOMAIN_DEFAULT))


class Profile(models.Model):
Expand Down
2 changes: 2 additions & 0 deletions emails/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def histogram_if_enabled(name, value, tags=None):


def get_email_domain_from_settings():
if settings.TEST_MOZMAIL:
return settings.ADDITIONAL_DOMAINS.first()
email_network_locality = urlparse(settings.SITE_ORIGIN).netloc
# on Heroku we need to add "mail" prefix
# because we can’t publish MX records on Heroku
Expand Down
1 change: 1 addition & 0 deletions privaterelay/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ def _get_initial_middleware():

WSGI_APPLICATION = 'privaterelay.wsgi.application'

TEST_MOZMAIL = config('TEST_MOZMAIL', False, cast=bool)

# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
Expand Down

0 comments on commit 53c061e

Please sign in to comment.