Post the supervisor api port to the resin api.

This commit is contained in:
Pagan Gazzard 2015-01-15 20:03:00 +00:00 committed by Pablo Carranza Vélez
parent c8023e0780
commit fafef6cc6f
2 changed files with 8 additions and 2 deletions

View File

@ -34,6 +34,10 @@ knex.init.then ->
console.log('Starting API server..')
api.listen(config.listenPort)
application.updateDeviceInfo(
api_port: config.listenPort
5000
)
console.log('Starting Apps..')
knex('app').select()

View File

@ -295,7 +295,7 @@ getDeviceID = do ->
throw new Error('Could not find this device?!')
return devices[0].id
exports.updateDeviceInfo = updateDeviceInfo = (body) ->
exports.updateDeviceInfo = updateDeviceInfo = (body, retry = false) ->
Promise.all([
knex('config').select('value').where(key: 'apiKey')
getDeviceID()
@ -309,4 +309,6 @@ exports.updateDeviceInfo = updateDeviceInfo = (body) ->
)
.catch (error) ->
utils.mixpanelTrack('Device info update failure', {error, body})
if retry isnt false
Promise.delay(retry).then ->
updateDeviceInfo(body, retry)