mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-18 10:46:22 +00:00
Tunnel all mixpanel events through the resin API
Change-Type: patch Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
This commit is contained in:
parent
4c5fd68aea
commit
34d37814c9
@ -1,10 +1,11 @@
|
|||||||
{ checkInt, checkString } = require './lib/validation'
|
{ checkInt, checkString } = require './lib/validation'
|
||||||
|
|
||||||
dockerRoot = checkString(process.env.DOCKER_ROOT) ? '/mnt/root/var/lib/rce'
|
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
|
# Defaults needed for both gosuper and node supervisor are declared in entry.sh
|
||||||
module.exports =
|
module.exports =
|
||||||
apiEndpoint: checkString(process.env.API_ENDPOINT)
|
apiEndpoint: apiEndpoint
|
||||||
apiTimeout: checkInt(process.env.API_TIMEOUT, positive: true) ? 15 * 60 * 1000
|
apiTimeout: checkInt(process.env.API_TIMEOUT, positive: true) ? 15 * 60 * 1000
|
||||||
listenPort: checkInt(process.env.LISTEN_PORT, positive: true) ? 80
|
listenPort: checkInt(process.env.LISTEN_PORT, positive: true) ? 80
|
||||||
gosuperAddress: "http://unix:#{process.env.GOSUPER_SOCKET}:"
|
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
|
publish_key: checkString(process.env.PUBNUB_PUBLISH_KEY) ? process.env.DEFAULT_PUBNUB_PUBLISH_KEY
|
||||||
ssl: true
|
ssl: true
|
||||||
mixpanelToken: checkString(process.env.MIXPANEL_TOKEN) ? process.env.DEFAULT_MIXPANEL_TOKEN
|
mixpanelToken: checkString(process.env.MIXPANEL_TOKEN) ? process.env.DEFAULT_MIXPANEL_TOKEN
|
||||||
|
mixpanelHost: "#{apiEndpoint}/mixpanel"
|
||||||
dockerSocket: process.env.DOCKER_SOCKET
|
dockerSocket: process.env.DOCKER_SOCKET
|
||||||
supervisorImage: checkString(process.env.SUPERVISOR_IMAGE) ? 'resin/rpi-supervisor'
|
supervisorImage: checkString(process.env.SUPERVISOR_IMAGE) ? 'resin/rpi-supervisor'
|
||||||
configMountPoint: checkString(process.env.CONFIG_MOUNT_POINT) ? '/mnt/mmcblk0p1/config.json'
|
configMountPoint: checkString(process.env.CONFIG_MOUNT_POINT) ? '/mnt/mmcblk0p1/config.json'
|
||||||
|
@ -19,7 +19,7 @@ exports.supervisorVersion = require('./lib/supervisor-version')
|
|||||||
|
|
||||||
configJson = JSON.parse(fs.readFileSync('/boot/config.json'))
|
configJson = JSON.parse(fs.readFileSync('/boot/config.json'))
|
||||||
if Boolean(config.apiEndpoint) and !Boolean(configJson.supervisorOfflineMode)
|
if Boolean(config.apiEndpoint) and !Boolean(configJson.supervisorOfflineMode)
|
||||||
mixpanelClient = mixpanel.init(config.mixpanelToken)
|
mixpanelClient = mixpanel.init(config.mixpanelToken, { host: config.mixpanelHost })
|
||||||
else
|
else
|
||||||
mixpanelClient = { track: _.noop }
|
mixpanelClient = { track: _.noop }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user