fix(profile_server_messaging): fix db constructor signature

Fixes #2916. The signature didn't cause any bugs, since the DB object is only used for very specific things in the profile_server_messaging and must-reset scripts, but this corrects the invocation.

Also makes the UnblockCode parameter explicitly optional.
This commit is contained in:
Ian Bicking 2019-03-12 18:06:49 -05:00
Родитель c36e9c1242
Коммит dd7c0e38fd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 1DA122EDDE590E8B
3 изменённых файлов: 6 добавлений и 15 удалений

Просмотреть файл

@ -11,7 +11,6 @@ require('../lib/newrelic')()
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)
@ -20,12 +19,7 @@ var push = require('../lib/push')
var DB = require('../lib/db')(
config,
log,
error,
Token.SessionToken,
Token.KeyFetchToken,
Token.AccountResetToken,
Token.PasswordForgotToken,
Token.PasswordChangeToken
Token
)
var profileUpdatesQueue = new SQSReceiver(config.profileServerMessaging.region, [

Просмотреть файл

@ -32,7 +32,7 @@ module.exports = (
config,
log,
Token,
UnblockCode
UnblockCode=null
) => {
const features = require('./features')(config)
@ -1056,6 +1056,9 @@ module.exports = (
SAFE_URLS.createUnblockCode = new SafeUrl('/account/:uid/unblock/:unblock', 'db.createUnblockCode')
DB.prototype.createUnblockCode = function (uid) {
if (! UnblockCode) {
return Promise.reject(new Error('Unblock has not been configured'));
}
log.trace('DB.createUnblockCode', { uid })
return UnblockCode()
.then(

Просмотреть файл

@ -21,7 +21,6 @@ var butil = require('../lib/crypto/butil')
var commandLineOptions = require('commander')
var config = require('../config').getProperties()
var crypto = require('crypto')
var error = require('../lib/error')
var log = require('../lib/log')(config.log.level)
var P = require('../lib/promise')
var path = require('path')
@ -41,12 +40,7 @@ requiredOptions.forEach(checkRequiredOption)
var DB = require('../lib/db')(
config,
log,
error,
Token.SessionToken,
Token.KeyFetchToken,
Token.AccountResetToken,
Token.PasswordForgotToken,
Token.PasswordChangeToken
Token
)
DB.connect(config[config.db.backend])