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

@ -68,7 +68,6 @@ function plugins (settings) {
balances[cryptoCode] = balanceRec.balance
})
console.log('DEBUG66: %j', balances)
return balances
}

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)

View file

@ -2,7 +2,7 @@ const util = require('util')
const config = require('./admin/config')
function valid () {
return config.validateConfig()
return config.validateCurrentConfig()
.then(errors => {
if (errors.length === 0) return
throw new Error('Schema validation error: ' + util.inspect(errors, {colors: true}))