config-validator to consider default values from schema (#139)
* config-validator to consider default values from schema * fix with relative json schema path * remove lamassuServerPath config on lamassu-migrate-options
This commit is contained in:
parent
d28c6ae691
commit
6fdb3e8834
7 changed files with 13 additions and 16 deletions
|
|
@ -25,11 +25,14 @@ async function run () {
|
|||
const currentOpts = options.opts
|
||||
|
||||
// check if there are new options to add
|
||||
const result = _.mergeAll([defaultOpts, currentOpts])
|
||||
const shouldMigrate = !_.isEqual(result, currentOpts)
|
||||
let result = _.mergeAll([defaultOpts, currentOpts])
|
||||
const shouldMigrate = !_.isEqual(result, currentOpts) || _.has('lamassuServerPath', result)
|
||||
|
||||
// write the resulting lamassu.json
|
||||
if (shouldMigrate) {
|
||||
// remove old lamassuServerPath config
|
||||
result = _.omit('lamassuServerPath', result)
|
||||
|
||||
const newOpts = _.pick(_.difference(_.keys(result), _.keys(currentOpts)), result)
|
||||
console.log('Adding options', newOpts)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue