fix: save default advanced trigger settings in user config
This commit is contained in:
parent
5ed84b7cdb
commit
85b60028f4
1 changed files with 14 additions and 9 deletions
|
|
@ -1,14 +1,19 @@
|
|||
const db = require('./db')
|
||||
|
||||
const { saveConfig } = require('../lib/new-settings-loader')
|
||||
|
||||
exports.up = function (next) {
|
||||
const triggersDefault = {
|
||||
triggersConfig_expirationTime: 'Forever',
|
||||
triggersConfig_automation: 'Automatic'
|
||||
}
|
||||
|
||||
const sql2 = [`insert into user_config (type, data, valid, schema_version) values ('config', '{"config":{
|
||||
"triggersConfig_expirationTime": "Forever",
|
||||
"triggersConfig_automation": "Automatic"
|
||||
} }', true, 2)`]
|
||||
|
||||
db.multi(sql2, next)
|
||||
return saveConfig(triggersDefault)
|
||||
.then(() => next())
|
||||
.catch(err => {
|
||||
if (err.message === 'lamassu-server is not configured') {
|
||||
next()
|
||||
}
|
||||
console.log(err.message)
|
||||
})
|
||||
}
|
||||
|
||||
exports.down = function (next) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue