Config can read smtp values from environment now

This commit is contained in:
Carlos Lopez 2020-06-05 13:54:37 -06:00
parent 57a7c7fa54
commit 663da57d8b
3 changed files with 8 additions and 7 deletions

View File

@ -44,5 +44,11 @@ PB_STUDY_DETAILS_URL = environ.get('PB_STUDY_DETAILS_URL', default=PB_BASE_URL +
LDAP_URL = environ.get('LDAP_URL', default="ldap.virginia.edu").strip('/') # No trailing slash or http://
LDAP_TIMEOUT_SEC = int(environ.get('LDAP_TIMEOUT_SEC', default=3))
# Fallback emails
# Email configuration
FALLBACK_EMAILS = ['askresearch@virginia.edu', 'sartographysupport@googlegroups.com']
MAIL_SERVER = environ.get('MAIL_SERVER', default='smtp.mailtrap.io')
MAIL_PORT = environ.get('MAIL_PORT', default=2525)
MAIL_USE_SSL = environ.get('MAIL_USE_SSL', default=False)
MAIL_USE_TLS = environ.get('MAIL_USE_TLS', default=True)
MAIL_USERNAME = environ.get('MAIL_USERNAME', default='5f012d0108d374')
MAIL_PASSWORD = environ.get('MAIL_PASSWORD', default='08442c04e98d50')

View File

@ -54,12 +54,6 @@ if app.config['ENABLE_SENTRY']:
template_dir = os.getcwd() + '/crc/static/templates/mails'
env = Environment(loader=FileSystemLoader(template_dir))
# Mail settings
app.config['MAIL_SERVER']='smtp.mailtrap.io'
app.config['MAIL_PORT'] = 2525
app.config['MAIL_USERNAME'] = '5f012d0108d374'
app.config['MAIL_PASSWORD'] = '08442c04e98d50'
app.config['MAIL_USE_TLS'] = True
app.config['MAIL_USE_SSL'] = False
mail = Mail(app)
print('=== USING THESE CONFIG SETTINGS: ===')

View File

@ -59,6 +59,7 @@ def send_ramp_up_approved_email(sender, recipients, approver_1, approver_2=None)
msg = Message('Research Ramp-up Plan Approved',
sender=sender,
recipients=recipients)
from crc import env, mail
template = env.get_template('ramp_up_approved.txt')
template_vars = {'approver_1': approver_1, 'approver_2': approver_2}