Verified Commit a393f6e9 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Refactor settings

parent 8c1894b9
......@@ -43,7 +43,7 @@ def send_membership_announcement(dry_run=False):
'[THALIA] {}'.format(
_('Membership announcement')),
email_body,
settings.WEBSITE_FROM_ADDRESS,
settings.DEFAULT_FROM_EMAIL,
[member.email],
bcc=[settings.BOARD_NOTIFICATION_ADDRESS],
connection=connection
......@@ -101,7 +101,7 @@ def send_information_request(dry_run=False):
'[THALIA] {}'.format(
_('Membership information check')),
email_body,
settings.WEBSITE_FROM_ADDRESS,
settings.DEFAULT_FROM_EMAIL,
[member.email],
connection=connection
).send()
......@@ -153,7 +153,7 @@ def send_expiration_announcement(dry_run=False):
'[THALIA] {}'.format(
_('Membership expiration announcement')),
email_body,
settings.WEBSITE_FROM_ADDRESS,
settings.DEFAULT_FROM_EMAIL,
[member.email],
bcc=[settings.BOARD_NOTIFICATION_ADDRESS],
connection=connection
......@@ -213,7 +213,7 @@ def send_email_change_confirmation_messages(change_request):
'name': member.first_name
}
),
settings.WEBSITE_FROM_ADDRESS,
settings.DEFAULT_FROM_EMAIL,
[member.email]
).send()
......@@ -231,7 +231,7 @@ def send_email_change_confirmation_messages(change_request):
'name': member.first_name
}
),
settings.WEBSITE_FROM_ADDRESS,
settings.DEFAULT_FROM_EMAIL,
[change_request.email]
).send()
......
......@@ -172,6 +172,6 @@ def _send_email(to, subject, body_template, context):
mail.EmailMessage(
'[THALIA] {}'.format(subject),
loader.render_to_string(body_template, context),
settings.WEBSITE_FROM_ADDRESS,
settings.DEFAULT_FROM_EMAIL,
[to]
).send()
......@@ -29,8 +29,8 @@ SECRET_KEY = os.environ.get('DJANGO_SECRET')
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = os.environ.get('DJANGO_DEBUG') == 'True'
if 'DJANGO_HOSTS' in os.environ:
ALLOWED_HOSTS = os.environ.get('DJANGO_HOSTS').split(',')
if 'SITE_DOMAIN' in os.environ:
ALLOWED_HOSTS = [os.environ.get('SITE_DOMAIN')]
# Database settings
DATABASES = {
......@@ -73,26 +73,11 @@ PASSWORD_HASHERS = [
'django.contrib.auth.hashers.BCryptPasswordHasher',
]
WIKI_API_KEY = os.environ.get('WIKI_API_KEY', 'changeme')
MIGRATION_KEY = os.environ.get('MIGRATION_KEY')
MAILINGLIST_API_SECRET = os.environ.get('MAILINGLIST_API_SECRET', '')
MEMBERS_SENTRY_API_SECRET = os.environ.get('MEMBERS_SENTRY_API_SECRET', '')
ACTIVEMEMBERS_NEXTCLOUD_API_SECRET = os.environ.get(
'ACTIVEMEMBERS_NEXTCLOUD_API_SECRET', '')
GOOGLE_MAPS_API_KEY = os.environ.get('GOOGLE_MAPS_API_KEY', '')
GOOGLE_MAPS_API_SECRET = os.environ.get('GOOGLE_MAPS_API_SECRET', '')
FIREBASE_CREDENTIALS = os.environ.get('FIREBASE_CREDENTIALS', '{}')
if not (FIREBASE_CREDENTIALS == '{}'):
FIREBASE_CREDENTIALS = base64.urlsafe_b64decode(FIREBASE_CREDENTIALS)
FIREBASE_CREDENTIALS = json.loads(FIREBASE_CREDENTIALS)
# Conscribo settings
CONSCRIBO_ACCOUNT = os.environ.get('CONSCRIBO_ACCOUNT', '')
CONSCRIBO_USER = os.environ.get('CONSCRIBO_USER', '')
CONSCRIBO_PASSWORD = os.environ.get('CONSCRIBO_PASSWORD', '')
if os.environ.get('DJANGO_SSLONLY'):
SECURE_SSL_REDIRECT = True
SESSION_COOKIE_SECURE = True
......
......@@ -36,7 +36,8 @@ if not DEBUG: # Django 1.10.3 security release changed behaviour
ALLOWED_HOSTS = []
SITE_ID = 1
BASE_URL = 'https://thalia.nu'
SITE_DOMAIN = os.environ.get('SITE_DOMAIN', 'thalia.localhost')
BASE_URL = f'https://{SITE_DOMAIN}'
DATA_UPLOAD_MAX_NUMBER_FIELDS = 10000 # Useful for managing members
......@@ -261,44 +262,44 @@ THUMBNAIL_SIZES = {
FIREBASE_CREDENTIALS = {}
# Default FROM email
DEFAULT_FROM_EMAIL = 'noreply@thalia.nu'
DEFAULT_FROM_EMAIL = f'noreply@{SITE_DOMAIN}'
SERVER_EMAIL = DEFAULT_FROM_EMAIL
# Newsletter settings
NEWSLETTER_FROM_ADDRESS = 'nieuwsbrief@thalia.nu'
# Website FROM address
WEBSITE_FROM_ADDRESS = 'noreply@thalia.nu'
NEWSLETTER_FROM_ADDRESS = f'newsletter@{SITE_DOMAIN}'
# Board notification address
BOARD_NOTIFICATION_ADDRESS = 'info@thalia.nu'
BOARD_NOTIFICATION_ADDRESS = os.environ.get(
'BOARD_NOTIFICATION_ADDRESS', 'info@thalia.nu')
# Partners notification email
PARTNER_EMAIL = "samenwerking@thalia.nu"
PARTNER_NOTIFICATION_ADDRESS = os.environ.get(
'PARTNER_NOTIFICATION_ADDRESS', 'samenwerking@thalia.nu')
# Conscribo settings
CONSCRIBO_ACCOUNT = ''
CONSCRIBO_USER = ''
CONSCRIBO_PASSWORD = ''
CONSCRIBO_ACCOUNT = os.environ.get('CONSCRIBO_ACCOUNT', '')
CONSCRIBO_USER = os.environ.get('CONSCRIBO_USER', '')
CONSCRIBO_PASSWORD = os.environ.get('CONSCRIBO_PASSWORD', '')
# Mailinglist API key
MAILINGLIST_API_SECRET = ''
MAILINGLIST_API_SECRET = os.environ.get('MAILINGLIST_API_SECRET', '')
# Members Sentry API key
MEMBERS_SENTRY_API_SECRET = ''
MEMBERS_SENTRY_API_SECRET = os.environ.get('MEMBERS_SENTRY_API_SECRET', '')
# Activemembers NextCloud API key
ACTIVEMEMBERS_NEXTCLOUD_API_SECRET = ''
ACTIVEMEMBERS_NEXTCLOUD_API_SECRET = os.environ.get(
'ACTIVEMEMBERS_NEXTCLOUD_API_SECRET', '')
# Google maps API key and secrets
GOOGLE_MAPS_API_KEY = ''
GOOGLE_MAPS_API_SECRET = ''
GOOGLE_MAPS_API_KEY = os.environ.get('GOOGLE_MAPS_API_KEY', '')
GOOGLE_MAPS_API_SECRET = os.environ.get('GOOGLE_MAPS_API_SECRET', '')
# Photos settings
PHOTO_UPLOAD_SIZE = 1920, 1080
# API key for wiki
WIKI_API_KEY = 'debug'
WIKI_API_KEY = os.environ.get('WIKI_API_KEY', 'debug')
# CORS config
CORS_ORIGIN_ALLOW_ALL = True
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment