From 34d37814c96abb24546c6d81ca4a16d9a9ca2860 Mon Sep 17 00:00:00 2001 From: Pablo Carranza Velez Date: Mon, 25 Sep 2017 06:39:46 -0700 Subject: [PATCH] Tunnel all mixpanel events through the resin API Change-Type: patch Signed-off-by: Pablo Carranza Velez --- src/config.coffee | 4 +++- src/utils.coffee | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/config.coffee b/src/config.coffee index 44998fe4..f9d1bd53 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -1,10 +1,11 @@ { checkInt, checkString } = require './lib/validation' dockerRoot = checkString(process.env.DOCKER_ROOT) ? '/mnt/root/var/lib/rce' +apiEndpoint = checkString(process.env.API_ENDPOINT) # Defaults needed for both gosuper and node supervisor are declared in entry.sh module.exports = - apiEndpoint: checkString(process.env.API_ENDPOINT) + apiEndpoint: apiEndpoint 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}:" @@ -15,6 +16,7 @@ module.exports = publish_key: checkString(process.env.PUBNUB_PUBLISH_KEY) ? process.env.DEFAULT_PUBNUB_PUBLISH_KEY ssl: true mixpanelToken: checkString(process.env.MIXPANEL_TOKEN) ? process.env.DEFAULT_MIXPANEL_TOKEN + mixpanelHost: "#{apiEndpoint}/mixpanel" dockerSocket: process.env.DOCKER_SOCKET supervisorImage: checkString(process.env.SUPERVISOR_IMAGE) ? 'resin/rpi-supervisor' configMountPoint: checkString(process.env.CONFIG_MOUNT_POINT) ? '/mnt/mmcblk0p1/config.json' diff --git a/src/utils.coffee b/src/utils.coffee index bebdf5b1..efeb7691 100644 --- a/src/utils.coffee +++ b/src/utils.coffee @@ -19,7 +19,7 @@ exports.supervisorVersion = require('./lib/supervisor-version') configJson = JSON.parse(fs.readFileSync('/boot/config.json')) if Boolean(config.apiEndpoint) and !Boolean(configJson.supervisorOfflineMode) - mixpanelClient = mixpanel.init(config.mixpanelToken) + mixpanelClient = mixpanel.init(config.mixpanelToken, { host: config.mixpanelHost }) else mixpanelClient = { track: _.noop }