2017-03-17 00:23:22 +03: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')()
|
|
|
|
|
2017-03-17 00:23:22 +03:00
|
|
|
var config = require('../config').getProperties()
|
|
|
|
var log = require('../lib/log')(config.log.level, 'profile-server-messaging')
|
|
|
|
var error = require('../lib/error')
|
|
|
|
var Token = require('../lib/tokens')(log, config)
|
|
|
|
var SQSReceiver = require('../lib/sqs')(log)
|
|
|
|
var profileUpdates = require('../lib/profile/updates')(log)
|
|
|
|
var push = require('../lib/push')
|
|
|
|
|
|
|
|
var DB = require('../lib/db')(
|
|
|
|
config,
|
|
|
|
log,
|
|
|
|
error,
|
|
|
|
Token.SessionToken,
|
|
|
|
Token.KeyFetchToken,
|
|
|
|
Token.AccountResetToken,
|
|
|
|
Token.PasswordForgotToken,
|
|
|
|
Token.PasswordChangeToken
|
|
|
|
)
|
|
|
|
|
|
|
|
var profileUpdatesQueue = new SQSReceiver(config.profileServerMessaging.region, [
|
|
|
|
config.profileServerMessaging.profileUpdatesQueueUrl
|
|
|
|
])
|
|
|
|
|
|
|
|
DB.connect(config[config.db.backend])
|
|
|
|
.then(
|
|
|
|
function (db) {
|
2017-09-12 22:17:08 +03:00
|
|
|
profileUpdates(profileUpdatesQueue, push(log, db, config), db)
|
2017-03-17 00:23:22 +03:00
|
|
|
}
|
|
|
|
)
|