2014-04-10 10:57:33 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2017-09-19 16:00:37 +03:00
|
|
|
'use strict'
|
|
|
|
|
2017-11-13 19:11:53 +03:00
|
|
|
// This MUST be the first require in the program.
|
|
|
|
// Only `require()` the newrelic module if explicity enabled.
|
|
|
|
// If required, modules will be instrumented.
|
|
|
|
require('../lib/newrelic')()
|
|
|
|
|
2015-08-17 19:48:34 +03:00
|
|
|
var config = require('../config').getProperties()
|
2015-05-13 02:54:21 +03:00
|
|
|
var log = require('../lib/log')(config.log.level, 'fxa-email-bouncer')
|
2015-05-10 22:11:59 +03:00
|
|
|
var error = require('../lib/error')
|
2016-09-22 19:44:34 +03:00
|
|
|
var Token = require('../lib/tokens')(log, config)
|
2016-02-10 07:35:18 +03:00
|
|
|
var SQSReceiver = require('../lib/sqs')(log)
|
2017-01-26 21:52:05 +03:00
|
|
|
var bounces = require('../lib/email/bounces')(log, error)
|
|
|
|
var delivery = require('../lib/email/delivery')(log)
|
2014-04-10 10:57:33 +04:00
|
|
|
|
2015-05-10 22:11:59 +03:00
|
|
|
var DB = require('../lib/db')(
|
2016-09-22 19:44:34 +03:00
|
|
|
config,
|
2014-04-10 10:57:33 +04:00
|
|
|
log,
|
2017-03-24 05:12:39 +03:00
|
|
|
Token
|
2014-04-10 10:57:33 +04:00
|
|
|
)
|
|
|
|
|
2017-01-26 21:52:05 +03:00
|
|
|
var bounceQueue = new SQSReceiver(config.emailNotifications.region, [
|
|
|
|
config.emailNotifications.bounceQueueUrl,
|
|
|
|
config.emailNotifications.complaintQueueUrl
|
|
|
|
])
|
|
|
|
|
|
|
|
var deliveryQueue = new SQSReceiver(config.emailNotifications.region, [
|
|
|
|
config.emailNotifications.deliveryQueueUrl
|
2016-02-10 07:35:18 +03:00
|
|
|
])
|
|
|
|
|
2014-04-10 10:57:33 +04:00
|
|
|
DB.connect(config[config.db.backend])
|
2017-03-01 21:06:46 +03:00
|
|
|
.then(
|
2014-04-10 10:57:33 +04:00
|
|
|
function (db) {
|
2016-02-10 07:35:18 +03:00
|
|
|
bounces(bounceQueue, db)
|
2017-01-26 21:52:05 +03:00
|
|
|
delivery(deliveryQueue)
|
2014-04-10 10:57:33 +04:00
|
|
|
}
|
|
|
|
)
|