Auto-merge for PR #453 via VersionBot

When apiEndpoint is not defined, work in offline mode (plus fix mixpanel init)
This commit is contained in:
resin-io-versionbot[bot] 2017-06-15 05:32:59 +00:00 committed by GitHub
commit f16c5d5e92
5 changed files with 9 additions and 4 deletions

View File

@ -4,6 +4,11 @@ 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/).
## v4.4.0 - 2017-06-15
* When apiEndpoint is not defined, work in offline mode [Pablo Carranza Velez]
* Fix mixpanel initialization when not in offline mode [Pablo Carranza Velez]
## v4.3.2 - 2017-06-14
* Update dependent device DB [Joe Roberts]

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": "4.3.2",
"version": "4.4.0",
"license": "Apache-2.0",
"repository": {
"type": "git",

View File

@ -175,7 +175,7 @@ bootstrapper.startBootstrapping = ->
readConfig()
.then (configFromFile) ->
userConfig = configFromFile
bootstrapper.offlineMode = Boolean(userConfig.supervisorOfflineMode)
bootstrapper.offlineMode = !Boolean(config.apiEndpoint) or Boolean(userConfig.supervisorOfflineMode)
knex('config').select('value').where(key: 'uuid')
.then ([ uuid ]) ->
if uuid?.value

View File

@ -4,7 +4,7 @@ dockerRoot = checkString(process.env.DOCKER_ROOT) ? '/mnt/root/var/lib/rce'
# Defaults needed for both gosuper and node supervisor are declared in entry.sh
module.exports =
apiEndpoint: checkString(process.env.API_ENDPOINT) ? 'https://api.resin.io'
apiEndpoint: checkString(process.env.API_ENDPOINT)
apiTimeout: checkInt(process.env.API_TIMEOUT, positive: true) ? 15 * 60 * 1000
listenPort: checkInt(process.env.LISTEN_PORT, positive: true) ? 80
gosuperAddress: "http://unix:#{process.env.GOSUPER_SOCKET}:"

View File

@ -18,7 +18,7 @@ device = require './device'
exports.supervisorVersion = require('./lib/supervisor-version')
configJson = require('/boot/config.json')
if Boolean(configJson.supervisorOfflineMode)
if Boolean(config.apiEndpoint) and !Boolean(configJson.supervisorOfflineMode)
mixpanelClient = mixpanel.init(config.mixpanelToken)
else
mixpanelClient = { track: _.noop }