mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-21 14:37:47 +00:00
commit
c8275b52c3
@ -22,10 +22,9 @@ import * as Mixpanel from 'mixpanel';
|
|||||||
import * as packageJSON from '../package.json';
|
import * as packageJSON from '../package.json';
|
||||||
import { getBalenaSdk } from './utils/lazy';
|
import { getBalenaSdk } from './utils/lazy';
|
||||||
|
|
||||||
const getMixpanel = _.once<any>(() => {
|
const getMixpanel = _.once((balenaUrl: string) => {
|
||||||
const settings = require('balena-settings-client');
|
|
||||||
return Mixpanel.init('balena-main', {
|
return Mixpanel.init('balena-main', {
|
||||||
host: `api.${settings.get('balenaUrl')}`,
|
host: `api.${balenaUrl}`,
|
||||||
path: '/mixpanel',
|
path: '/mixpanel',
|
||||||
protocol: 'https',
|
protocol: 'https',
|
||||||
});
|
});
|
||||||
@ -47,10 +46,11 @@ const getMixpanel = _.once<any>(() => {
|
|||||||
*/
|
*/
|
||||||
export function trackCommand(commandSignature: string) {
|
export function trackCommand(commandSignature: string) {
|
||||||
const balena = getBalenaSdk();
|
const balena = getBalenaSdk();
|
||||||
|
const balenaUrlPromise = balena.settings.get('balenaUrl');
|
||||||
return Bluebird.props({
|
return Bluebird.props({
|
||||||
balenaUrl: balena.settings.get('balenaUrl'),
|
balenaUrl: balenaUrlPromise,
|
||||||
username: balena.auth.whoami().catchReturn(undefined),
|
username: balena.auth.whoami().catchReturn(undefined),
|
||||||
mixpanel: getMixpanel(),
|
mixpanel: balenaUrlPromise.then(getMixpanel),
|
||||||
})
|
})
|
||||||
.then(({ username, balenaUrl, mixpanel }) => {
|
.then(({ username, balenaUrl, mixpanel }) => {
|
||||||
Sentry.configureScope(scope => {
|
Sentry.configureScope(scope => {
|
||||||
|
Loading…
Reference in New Issue
Block a user