Skip to content

Commit

Permalink
Merge pull request #638 from raph-topo/patch-allowed-hosts
Browse files Browse the repository at this point in the history
feat: Allow DJANGO_ALLOWED_HOSTS to be a csv

#637
  • Loading branch information
maxking authored Jun 27, 2023
2 parents 244b73d + 57a2f54 commit 4c6664c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions postorius/mailman-web/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,14 @@
SITE_ID = 1

# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.8/ref/settings/#allowed-hosts
# See https://docs.djangoproject.com/en/3.1/ref/settings/#allowed-hosts
ALLOWED_HOSTS = [
"localhost", # Archiving API from Mailman, keep it.
# "lists.your-domain.org",
# Add here all production URLs you may have.
"mailman-web",
gethostbyname("mailman-web"),
os.environ.get('SERVE_FROM_DOMAIN'),
os.environ.get('DJANGO_ALLOWED_HOSTS'),
]
ALLOWED_HOSTS.extend(os.getenv("DJANGO_ALLOWED_HOSTS", "").split(","))

# Mailman API credentials
MAILMAN_REST_API_URL = os.environ.get('MAILMAN_REST_URL', 'http://mailman-core:8001')
Expand Down
2 changes: 1 addition & 1 deletion web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ change them unless you know what you want.
`/opt/mailman-web-data/logs/mailmanweb.log`.

- `DJANGO_ALLOWED_HOSTS`: Entry to add to ALLOWED_HOSTS in Django
configuration. This is a separate configuration from`SERVE_FROM_DOMAIN` as
configuration. Format as comma-separated list (no whitespace). This is a separate configuration from`SERVE_FROM_DOMAIN` as
latter is used for other purposes too.

- `POSTORIUS_TEMPLATE_BASE_URL`: The base url at which the `mailman-web`
Expand Down
4 changes: 1 addition & 3 deletions web/mailman-web/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,11 @@
# See https://docs.djangoproject.com/en/3.1/ref/settings/#allowed-hosts
ALLOWED_HOSTS = [
"localhost", # Archiving API from Mailman, keep it.
# "lists.your-domain.org",
# Add here all production URLs you may have.
"mailman-web",
gethostbyname("mailman-web"),
os.environ.get('SERVE_FROM_DOMAIN'),
os.environ.get('DJANGO_ALLOWED_HOSTS'),
]
ALLOWED_HOSTS.extend(os.getenv("DJANGO_ALLOWED_HOSTS", "").split(","))

# Mailman API credentials
MAILMAN_REST_API_URL = os.environ.get('MAILMAN_REST_URL', 'http://mailman-core:8001')
Expand Down

0 comments on commit 4c6664c

Please sign in to comment.