Keep method of loading JSON files consistent

This commit is contained in:
Petros Angelatos 2014-06-18 20:17:51 +01:00 committed by Pablo Carranza Vélez
parent 7b483e983d
commit d06b5117f0

View File

@ -11,7 +11,7 @@ request = Promise.promisify require 'request'
module.exports = -> module.exports = ->
# Load config file # Load config file
userConfig = fs.readFileAsync('/boot/config.json', 'utf8').then(JSON.parse) userConfig = require('/boot/config.json')
version = utils.getSupervisorVersion() version = utils.getSupervisorVersion()
@ -37,8 +37,8 @@ module.exports = ->
division: '' division: ''
) )
Promise.all([userConfig, keys, version]) Promise.all([keys, version])
.then ([userConfig, keys, version]) -> .then ([keys, version]) ->
console.log('UUID:', uuid) console.log('UUID:', uuid)
console.log('User ID:', userConfig.userId) console.log('User ID:', userConfig.userId)
console.log('User:', userConfig.username) console.log('User:', userConfig.username)
@ -74,8 +74,6 @@ module.exports = ->
Promise.all([ Promise.all([
knex('config').truncate() knex('config').truncate()
.then -> .then ->
userConfig
.then (userConfig) ->
knex('config').insert([ knex('config').insert([
{ key: 'uuid', value: uuid } { key: 'uuid', value: uuid }
{ key: 'apiKey', value: userConfig.apiKey } { key: 'apiKey', value: userConfig.apiKey }