Save parameters in SQLite on successful bootstrapping

This commit is contained in:
Petros Aggelatos 2013-12-23 04:28:34 +00:00 committed by Pablo Carranza Vélez
parent 1dc26396a2
commit 91b59abd42

View File

@ -54,4 +54,19 @@ module.exports = (uuid) ->
fs.writeFileAsync('/supervisor/data/client.crt', body.cert)
vpnConf
])
).then(knex('config').select('value').where(key: 'uuid')
).then(->
console.log('Finishing bootstrapping')
Promise.all([
knex('config').truncate().then(config).then((config) ->
knex('config').insert([
{key: 'uuid', value: uuid}
{key: 'apiKey', value: config.apiKey}
{key: 'username', value: config.username}
{key: 'userId', value: config.userId}
])
)
knex('app').truncate()
])
).catch((error) ->
console.log(error)
)