mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-18 18:56:24 +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
|
||||
|
||||
* 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) ->
|
||||
remoteAppEnvs = {}
|
||||
remoteApps = _.map remoteApps, (app) ->
|
||||
env =
|
||||
RESIN_DEVICE_UUID: uuid
|
||||
RESIN: '1'
|
||||
USER: 'root'
|
||||
|
||||
if app.environment_variable?
|
||||
_.extend(env, app.environment_variable)
|
||||
env = utils.extendEnvVars(app.environment_variable, uuid)
|
||||
remoteAppEnvs[app.id] = env
|
||||
env = _.omit(env, _.keys(specialActionEnvVars))
|
||||
return {
|
||||
|
@ -22,12 +22,7 @@ loadPreloadedApps = ->
|
||||
fs.readFileAsync(appsPath, 'utf8')
|
||||
.then(JSON.parse)
|
||||
.map (app) ->
|
||||
env =
|
||||
RESIN_DEVICE_UUID: userConfig.uuid
|
||||
RESIN: '1'
|
||||
USER: 'root'
|
||||
_.extend(app.env, env)
|
||||
app.env = JSON.stringify(app.env)
|
||||
app.env = JSON.stringify(utils.extendEnvVars(app.env, userConfig.uuid))
|
||||
knex('app').insert(app)
|
||||
.catch (err) ->
|
||||
utils.mixpanelTrack('Loading preloaded apps failed', {error: err})
|
||||
|
@ -96,3 +96,12 @@ exports.connectivityCheck = _.once ->
|
||||
else
|
||||
console.log('Waiting for connectivity...')
|
||||
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…
Reference in New Issue
Block a user