mailman3: re-sync custom web/settings.py
The version in the container config repository has moved on, update our copy with overrides for the allowed hosts and site ID. Adjust how we generate the allowed hosts envvar list to replace Exim's field separators with those expected by Mailman. Change-Id: Ia6831ca10e1cd1ad057475e0f78eacc02857eef2
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
# This file has been copied from:
|
# This file has been copied from:
|
||||||
# https://github.com/maxking/docker-mailman/blob/2693386453ff3865b7c106c6aa456b683bd3bf08/web/mailman-web/settings.py
|
# https://github.com/maxking/docker-mailman/blob/57a2f54/web/mailman-web/settings.py
|
||||||
# In order to override the ALLOWED_HOSTS and SITE_ID settings.
|
# In order to override the ALLOWED_HOSTS and SITE_ID settings.
|
||||||
#
|
#
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright (C) 1998-2016 by the Free Software Foundation, Inc.
|
# Copyright (C) 1998-2016 by the Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is part of Mailman Suite.
|
# This file is part of Mailman Suite.
|
||||||
@@ -54,24 +55,12 @@ SITE_ID = 0
|
|||||||
# See https://docs.djangoproject.com/en/3.1/ref/settings/#allowed-hosts
|
# See https://docs.djangoproject.com/en/3.1/ref/settings/#allowed-hosts
|
||||||
ALLOWED_HOSTS = [
|
ALLOWED_HOSTS = [
|
||||||
"localhost", # Archiving API from Mailman, keep it.
|
"localhost", # Archiving API from Mailman, keep it.
|
||||||
"127.0.0.1", # Archiving API from Mailman, keep it. OpenDev edit
|
"127.0.0.1", # OpenDev addition because we use host networking
|
||||||
# "lists.your-domain.org",
|
#"mailman-web", # OpenDev edit, won't resolve for us
|
||||||
# Add here all production URLs you may have.
|
#gethostbyname("mailman-web"), # OpenDev edit, won't resolve for us
|
||||||
# The next two entries are commented out to prevent name resolution
|
|
||||||
# problems. This is an opendev local edit.
|
|
||||||
# Note we cannot use settings_local.py as this entry is evaluated at
|
|
||||||
# import time.
|
|
||||||
#"mailman-web",
|
|
||||||
#gethostbyname("mailman-web"),
|
|
||||||
os.environ.get('SERVE_FROM_DOMAIN'),
|
os.environ.get('SERVE_FROM_DOMAIN'),
|
||||||
#os.environ.get('DJANGO_ALLOWED_HOSTS'),
|
|
||||||
]
|
]
|
||||||
|
ALLOWED_HOSTS.extend(os.getenv("DJANGO_ALLOWED_HOSTS", "").split(","))
|
||||||
# We have modified handling of DJANGO_ALLOWED_HOSTS here to deserialize a
|
|
||||||
# list of hosts into a python list of strings.
|
|
||||||
django_allowed_hosts = os.environ.get('DJANGO_ALLOWED_HOSTS')
|
|
||||||
if django_allowed_hosts:
|
|
||||||
ALLOWED_HOSTS.extend(django_allowed_hosts.split(':'))
|
|
||||||
|
|
||||||
# Mailman API credentials
|
# Mailman API credentials
|
||||||
MAILMAN_REST_API_URL = os.environ.get('MAILMAN_REST_URL', 'http://mailman-core:8001')
|
MAILMAN_REST_API_URL = os.environ.get('MAILMAN_REST_URL', 'http://mailman-core:8001')
|
||||||
@@ -194,7 +183,7 @@ AUTH_PASSWORD_VALIDATORS = [
|
|||||||
|
|
||||||
LANGUAGE_CODE = 'en-us'
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
TIME_ZONE = 'UTC'
|
TIME_ZONE = os.environ.get('TZ', 'UTC')
|
||||||
|
|
||||||
USE_I18N = True
|
USE_I18N = True
|
||||||
|
|
||||||
|
@@ -41,7 +41,7 @@ services:
|
|||||||
#- MAILMAN_ADMIN_USER={{ mailman3_admin_user }}
|
#- MAILMAN_ADMIN_USER={{ mailman3_admin_user }}
|
||||||
#- MAILMAN_ADMIN_EMAIL={{ mailman3_admin_email }}
|
#- MAILMAN_ADMIN_EMAIL={{ mailman3_admin_email }}
|
||||||
- SERVE_FROM_DOMAIN=lists.opendev.org
|
- SERVE_FROM_DOMAIN=lists.opendev.org
|
||||||
- DJANGO_ALLOWED_HOSTS={{ mm_domains }}
|
- DJANGO_ALLOWED_HOSTS={{ mm_domains.split(':') | join(',') }}
|
||||||
- DATABASE_TYPE=mysql
|
- DATABASE_TYPE=mysql
|
||||||
- DATABASE_URL=mysql://mailman:{{ mailman3_db_password }}@127.0.0.1:3306/mailmandb?charset=utf8mb4
|
- DATABASE_URL=mysql://mailman:{{ mailman3_db_password }}@127.0.0.1:3306/mailmandb?charset=utf8mb4
|
||||||
- HYPERKITTY_API_KEY={{ mailman3_hyperkitty_api_key }}
|
- HYPERKITTY_API_KEY={{ mailman3_hyperkitty_api_key }}
|
||||||
|
Reference in New Issue
Block a user