improve config saving; fix pairing bug
This commit is contained in:
parent
67e12b19cb
commit
f3f46f7b5b
4 changed files with 81 additions and 9 deletions
|
|
@ -3,6 +3,7 @@ const _ = require('lodash/fp')
|
|||
const configManager = require('./config-manager')
|
||||
const machines = require('./admin/machines')
|
||||
const schema = require('../lamassu-schema.json')
|
||||
const logger = require('./logger')
|
||||
|
||||
function allScopes (cryptoScopes, machineScopes) {
|
||||
const scopes = []
|
||||
|
|
@ -47,7 +48,9 @@ function satisfiesRequire (config, cryptos, machineList, field, refFields) {
|
|||
const isBlank = _.isNil(configManager.scopedValue(scope[0], scope[1], fieldCode, config))
|
||||
const isRequired = refFields.length === 0 || isEnabled()
|
||||
|
||||
return isRequired ? !isBlank : true
|
||||
const isValid = isRequired ? !isBlank : true
|
||||
|
||||
return isValid
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -148,6 +151,7 @@ function validate (config) {
|
|||
.then(() => validateRequires(config))
|
||||
.then(arr => {
|
||||
if (arr.length === 0) return config
|
||||
logger.error('Invalid configuration: %j', arr)
|
||||
throw new Error('Invalid configuration')
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue