Write the registered_at time to config.json as well, in case there is a failure between writing to config.json and writing to knex [Page]

This commit is contained in:
Pagan Gazzard 2015-05-20 14:22:37 +01:00 committed by Pablo Carranza Vélez
parent f03df0b4ad
commit 4003bd4828
2 changed files with 3 additions and 0 deletions

View File

@ -1,3 +1,5 @@
* Write the `registered_at` time to config.json as well, in case there is a failure between writing to config.json and writing to knex [Page]
# v0.0.14
* Clean up tmp files left behind by npm [Page]

View File

@ -37,6 +37,7 @@ module.exports = ->
registerDevice(userConfig.apiKey, userConfig.userId, userConfig.applicationId, userConfig.deviceType, userConfig.uuid)
.then (device) ->
userConfig.uuid = device.uuid
userConfig.registered_at = Date.now()
userConfig.deviceId = device.id
fs.writeFileAsync('/boot/config.json', JSON.stringify(userConfig))
.return(userConfig)