fix config version

This commit is contained in:
Josh Harvey 2016-12-20 18:22:57 +02:00
parent 32ffe433a8
commit 24770e825e
7 changed files with 141 additions and 90 deletions

View file

@ -71,7 +71,6 @@ function poll (req, res, next) {
response.idVerificationLimit = config.idVerificationLimit
}
console.log('DEBUG78: %j', response.balances)
return res.json(response)
})
.catch(next)
@ -423,19 +422,14 @@ function populateDeviceId (req, res, next) {
}
function populateSettings (req, res, next) {
if (req.query.force_config === 'true') {
return settingsLoader.loadLatest()
.then(settings => { req.settings = settings })
.then(() => next())
.catch(next)
}
const versionId = req.headers['config-version']
logger.debug('versionId: %s', versionId)
if (!versionId) {
logger.debug('No config-version header')
return res.sendStatus(400)
return settingsLoader.loadLatest()
.then(settings => { req.settings = settings })
.then(() => next())
.catch(next)
}
settingsLoader.load(versionId)