diff --git a/src/bootstrap.coffee b/src/bootstrap.coffee index 0cdb4b56..da08583e 100644 --- a/src/bootstrap.coffee +++ b/src/bootstrap.coffee @@ -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) + )