Auto-merge for PR #544 via VersionBot

Fix saving deviceApiKey to the DB (to fix the RESIN_API_KEY env var)
This commit is contained in:
resin-io-versionbot[bot] 2018-01-12 15:59:32 +00:00 committed by GitHub
commit 122b55fbe5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View File

@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
This project adheres to [Semantic Versioning](http://semver.org/).
## v6.5.9 - 2018-01-12
* Fix saving deviceApiKey to the DB (to fix the RESIN_API_KEY env var) when updating from some older supervisors #544 [Pablo Carranza Velez]
## v6.5.8 - 2018-01-10
* Update docker-toolbelt to v3.2.1 to fix a bug in deltas #543 [Pablo Carranza Velez]

View File

@ -1,7 +1,7 @@
{
"name": "resin-supervisor",
"description": "This is resin.io's Supervisor, a program that runs on IoT devices and has the task of running user Apps (which are Docker containers), and updating them as Resin's API informs it to.",
"version": "6.5.8",
"version": "6.5.9",
"license": "Apache-2.0",
"repository": {
"type": "git",

View File

@ -223,6 +223,17 @@ bootstrapper.done = new Promise (resolve) ->
# This will only be the case when the supervisor/OS has been updated.
if userConfig.apiKey?
exchangeKeyOrRetry()
else
Promise.join(
knex('config').select('value').where(key: 'apiKey')
knex('config').select('value').where(key: 'deviceApiKey')
([ apiKey ], [ deviceApiKey ]) ->
if !deviceApiKey?.value
# apiKey in the DB is actually the deviceApiKey, but it was
# exchanged in a supervisor version that didn't save it to the DB
# (which mainly affects the RESIN_API_KEY env var)
knex('config').insert({ key: 'deviceApiKey', value: apiKey.value })
)
return
bootstrapper.bootstrapped = false