Updated bulk-email service to use mailgun settings

refs #10318
This commit is contained in:
Fabien O'Carroll 2020-07-02 18:09:04 +02:00 committed by Fabien 'egg' O'Carroll
parent 061d8c6ac3
commit 5e6a4f6f7d

View File

@ -20,9 +20,14 @@ function createMailgun(config) {
function getInstance() {
const bulkEmailConfig = configService.get('bulkEmail');
const bulkEmailSetting = settingsCache.get('bulk_email_settings');
const bulkEmailSetting = {
apiKey: settingsCache.get('mailgun_api_key'),
domain: settingsCache.get('mailgun_domain'),
baseUrl: settingsCache.get('mailgun_base_url')
};
const hasMailgunConfig = !!(bulkEmailConfig && bulkEmailConfig.mailgun);
const hasMailgunSetting = !!(bulkEmailSetting && bulkEmailSetting.apiKey && bulkEmailSetting.baseUrl && bulkEmailSetting.domain);
if (!hasMailgunConfig && !hasMailgunSetting) {
logging.warn(`Bulk email service is not configured`);
} else {