mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-31 08:25:36 +00:00
Use a function in utils to extend env vars
This commit is contained in:
parent
65df89aab6
commit
8da8092104
@ -1,3 +1,5 @@
|
|||||||
|
* Fix preloaded apps so that they have the complete environment [Pablo]
|
||||||
|
|
||||||
# v0.0.17
|
# v0.0.17
|
||||||
|
|
||||||
* Updated bases image to board-specific, and all node versions to 0.10.40-slim [Pablo]
|
* Updated bases image to board-specific, and all node versions to 0.10.40-slim [Pablo]
|
||||||
|
@ -354,13 +354,7 @@ application.update = update = (force) ->
|
|||||||
.then (remoteApps) ->
|
.then (remoteApps) ->
|
||||||
remoteAppEnvs = {}
|
remoteAppEnvs = {}
|
||||||
remoteApps = _.map remoteApps, (app) ->
|
remoteApps = _.map remoteApps, (app) ->
|
||||||
env =
|
env = utils.extendEnvVars(app.environment_variable, uuid)
|
||||||
RESIN_DEVICE_UUID: uuid
|
|
||||||
RESIN: '1'
|
|
||||||
USER: 'root'
|
|
||||||
|
|
||||||
if app.environment_variable?
|
|
||||||
_.extend(env, app.environment_variable)
|
|
||||||
remoteAppEnvs[app.id] = env
|
remoteAppEnvs[app.id] = env
|
||||||
env = _.omit(env, _.keys(specialActionEnvVars))
|
env = _.omit(env, _.keys(specialActionEnvVars))
|
||||||
return {
|
return {
|
||||||
|
@ -22,12 +22,7 @@ loadPreloadedApps = ->
|
|||||||
fs.readFileAsync(appsPath, 'utf8')
|
fs.readFileAsync(appsPath, 'utf8')
|
||||||
.then(JSON.parse)
|
.then(JSON.parse)
|
||||||
.map (app) ->
|
.map (app) ->
|
||||||
env =
|
app.env = JSON.stringify(utils.extendEnvVars(app.env, userConfig.uuid))
|
||||||
RESIN_DEVICE_UUID: userConfig.uuid
|
|
||||||
RESIN: '1'
|
|
||||||
USER: 'root'
|
|
||||||
_.extend(app.env, env)
|
|
||||||
app.env = JSON.stringify(app.env)
|
|
||||||
knex('app').insert(app)
|
knex('app').insert(app)
|
||||||
.catch (err) ->
|
.catch (err) ->
|
||||||
utils.mixpanelTrack('Loading preloaded apps failed', {error: err})
|
utils.mixpanelTrack('Loading preloaded apps failed', {error: err})
|
||||||
|
@ -96,3 +96,12 @@ exports.connectivityCheck = _.once ->
|
|||||||
else
|
else
|
||||||
console.log('Waiting for connectivity...')
|
console.log('Waiting for connectivity...')
|
||||||
blink.pattern.start(networkPattern)
|
blink.pattern.start(networkPattern)
|
||||||
|
|
||||||
|
exports.extendEnvVars = (env, uuid) ->
|
||||||
|
newEnv =
|
||||||
|
RESIN_DEVICE_UUID: uuid
|
||||||
|
RESIN: '1'
|
||||||
|
USER: 'root'
|
||||||
|
if env?
|
||||||
|
_.extend(newEnv, env)
|
||||||
|
return newEnv
|
||||||
|
Loading…
x
Reference in New Issue
Block a user