Skip to content
Snippets Groups Projects
Commit fa68a3b5 authored by Bjarke Madsen's avatar Bjarke Madsen
Browse files

Add config for enabling emails

parent ffeaffcb
No related branches found
No related tags found
1 merge request!69Feature/comp 257 send email on signup
......@@ -67,6 +67,17 @@ def _create_app_with_db(app_config) -> Flask:
# for the publishers
app.config['SQLALCHEMY_BINDS'] = app_config['SQLALCHEMY_BINDS']
if 'mail' in app_config:
mail_config = app_config['mail']
app.config['MAIL_ENABLE'] = True
app.config['MAIL_SERVER'] = mail_config['MAIL_SERVER']
app.config['MAIL_PORT'] = mail_config['MAIL_PORT']
app.config['MAIL_SENDER_EMAIL'] = mail_config['MAIL_SENDER_EMAIL'] # email address to send emails from
excluded_admins = mail_config.get('MAIL_EXCLUDED_ADMINS', [])
app.config['MAIL_EXCLUDED_ADMINS'] = excluded_admins # list of admin emails not to send emails to
else:
app.config['MAIL_ENABLE'] = False
db.init_app(app)
return app
......
......@@ -17,6 +17,20 @@ CONFIG_SCHEMA = {
'required': ['client_id', 'client_secret', 'server_metadata_url'],
'additionalProperties': False
},
'mail': {
'type': 'object',
'properties': {
'MAIL_SERVER': {'type': 'string'},
'MAIL_PORT': {'type': 'integer'},
'MAIL_SENDER_EMAIL': {'type': 'string', 'format': 'email'},
'MAIL_EXCLUDED_ADMINS': {
'type': 'array',
'items': {'type': 'string', 'format': 'email'}
}
},
'required': ['MAIL_SERVER', 'MAIL_PORT', 'MAIL_SENDER_EMAIL'],
'additionalProperties': False
},
'SECRET_KEY': {'type': 'string'},
},
'required': ['SQLALCHEMY_DATABASE_URI', 'SURVEY_DATABASE_URI', 'SECRET_KEY'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment