mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-17 10:19:47 +00:00
Merge pull request #86 from resin-io/18-expose-apikey-to-app
Expose resin API key to apps
This commit is contained in:
commit
3e18a350f1
@ -1,3 +1,4 @@
|
|||||||
|
* Expose resin API key to apps [Pablo]
|
||||||
* On download start, set download_progress to 0. On finish, set state to Idle [Pablo]
|
* On download start, set download_progress to 0. On finish, set state to Idle [Pablo]
|
||||||
* Set GOARM separately for each architecture [Pablo]
|
* Set GOARM separately for each architecture [Pablo]
|
||||||
* Add armv5 (armel) build [Trong]
|
* Add armv5 (armel) build [Trong]
|
||||||
|
@ -489,11 +489,6 @@ compareForUpdate = (localApps, remoteApps, localAppEnvs, remoteAppEnvs) ->
|
|||||||
allAppIds = _.union(localAppIds, remoteAppIds)
|
allAppIds = _.union(localAppIds, remoteAppIds)
|
||||||
return { toBeRemoved, toBeDownloaded, toBeInstalled, toBeUpdated, appsWithChangedEnvs, allAppIds }
|
return { toBeRemoved, toBeDownloaded, toBeInstalled, toBeUpdated, appsWithChangedEnvs, allAppIds }
|
||||||
|
|
||||||
getConfig = (key) ->
|
|
||||||
knex('config').select('value').where({ key })
|
|
||||||
.then ([ conf ]) ->
|
|
||||||
return conf?.value
|
|
||||||
|
|
||||||
application.update = update = (force) ->
|
application.update = update = (force) ->
|
||||||
if updateStatus.state isnt UPDATE_IDLE
|
if updateStatus.state isnt UPDATE_IDLE
|
||||||
# Mark an update required after the current.
|
# Mark an update required after the current.
|
||||||
@ -502,7 +497,7 @@ application.update = update = (force) ->
|
|||||||
return
|
return
|
||||||
updateStatus.state = UPDATE_UPDATING
|
updateStatus.state = UPDATE_UPDATING
|
||||||
bootstrap.done.then ->
|
bootstrap.done.then ->
|
||||||
Promise.join getConfig('apiKey'), getConfig('uuid'), knex('app').select(), (apiKey, uuid, apps) ->
|
Promise.join utils.getConfig('apiKey'), utils.getConfig('uuid'), knex('app').select(), (apiKey, uuid, apps) ->
|
||||||
deviceId = device.getID()
|
deviceId = device.getID()
|
||||||
remoteApps = getRemoteApps(uuid, apiKey)
|
remoteApps = getRemoteApps(uuid, apiKey)
|
||||||
|
|
||||||
|
@ -125,6 +125,11 @@ exports.getOrGenerateSecret = (name) ->
|
|||||||
generateSecret(name)
|
generateSecret(name)
|
||||||
return secretPromises[name]
|
return secretPromises[name]
|
||||||
|
|
||||||
|
exports.getConfig = getConfig = (key) ->
|
||||||
|
knex('config').select('value').where({ key })
|
||||||
|
.then ([ conf ]) ->
|
||||||
|
return conf?.value
|
||||||
|
|
||||||
exports.extendEnvVars = (env, uuid) ->
|
exports.extendEnvVars = (env, uuid) ->
|
||||||
host = '127.0.0.1'
|
host = '127.0.0.1'
|
||||||
newEnv =
|
newEnv =
|
||||||
@ -134,6 +139,7 @@ exports.extendEnvVars = (env, uuid) ->
|
|||||||
RESIN_SUPERVISOR_PORT: config.listenPort
|
RESIN_SUPERVISOR_PORT: config.listenPort
|
||||||
RESIN_SUPERVISOR_API_KEY: exports.getOrGenerateSecret('api')
|
RESIN_SUPERVISOR_API_KEY: exports.getOrGenerateSecret('api')
|
||||||
RESIN_SUPERVISOR_VERSION: exports.supervisorVersion
|
RESIN_SUPERVISOR_VERSION: exports.supervisorVersion
|
||||||
|
RESIN_API_KEY: getConfig('apiKey')
|
||||||
RESIN: '1'
|
RESIN: '1'
|
||||||
USER: 'root'
|
USER: 'root'
|
||||||
if env?
|
if env?
|
||||||
|
Loading…
Reference in New Issue
Block a user