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