Add all expected env vars to the new supervisor container.

This commit is contained in:
Page 2014-06-15 12:32:23 +01:00 committed by Pablo Carranza Vélez
parent f78786b065
commit 959da25c9f
2 changed files with 14 additions and 6 deletions

View File

@ -4,5 +4,14 @@ module.exports = config =
pubnub: pubnub:
subscribe_key: process.env.PUBNUB_SUBSCRIBE_KEY subscribe_key: process.env.PUBNUB_SUBSCRIBE_KEY
publish_key: process.env.PUBNUB_PUBLISH_KEY publish_key: process.env.PUBNUB_PUBLISH_KEY
expectedEnvVars: [
'API_ENDPOINT'
'REGISTRY_ENDPOINT'
'PUBNUB_SUBSCRIBE_KEY'
'PUBNUB_PUBLISH_KEY'
]
# A check that all variables are set and notify the user if not
for envVar in config.expectedEnvVars when !process.env[envVar]?
console.error('Cannot find env var:', envVar)
# TODO add a check that all variables are set and notify the user if not

View File

@ -12,7 +12,7 @@ Promise.promisifyAll(docker.getImage().__proto__)
Promise.promisifyAll(docker.getContainer().__proto__) Promise.promisifyAll(docker.getContainer().__proto__)
localImage = 'resin/rpi-supervisor' localImage = 'resin/rpi-supervisor'
remoteImage = config.REGISTRY_ENDPOINT + '/' + localImage remoteImage = config.registryEndpoint + '/' + localImage
supervisorUpdating = Promise.resolve() supervisorUpdating = Promise.resolve()
exports.update = -> exports.update = ->
@ -44,10 +44,9 @@ exports.update = ->
'/boot/config.json': '/mnt/mmcblk0p1/config.json' '/boot/config.json': '/mnt/mmcblk0p1/config.json'
'/data': '/var/lib/docker/data' '/data': '/var/lib/docker/data'
'/run/docker.sock': '/var/run/docker.sock' '/run/docker.sock': '/var/run/docker.sock'
Env: [ Env:
'API_ENDPOINT=' + config.API_ENDPOINT for envVar in config.expectedEnvVars
'REGISTRY_ENDPOINT=' + config.REGISTRY_ENDPOINT envVar + '=' + process.env[envVar]
]
) )
.then (container) -> .then (container) ->
console.log('Starting updated supervisor container:', localImage) console.log('Starting updated supervisor container:', localImage)