mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-20 06:07:57 +00:00
Handle empty apiEndpoint when detecting mixpanel host
Change-type: patch Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
parent
940d8c9862
commit
dfa9034fe9
@ -108,6 +108,9 @@ export function createProviderFunctions(
|
||||
mixpanelHost: {
|
||||
get: () => {
|
||||
return config.get('apiEndpoint').then(apiEndpoint => {
|
||||
if (!apiEndpoint) {
|
||||
return null;
|
||||
}
|
||||
const url = new URL(apiEndpoint as string);
|
||||
return { host: url.host, path: '/mixpanel' };
|
||||
});
|
||||
|
@ -12,7 +12,7 @@ export type EventTrackProperties = Dictionary<any>;
|
||||
interface InitArgs {
|
||||
uuid: string;
|
||||
offlineMode: boolean;
|
||||
mixpanelHost: { host: string; path: string };
|
||||
mixpanelHost: { host: string; path: string } | null;
|
||||
mixpanelToken: string;
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ export class EventTracker {
|
||||
uuid,
|
||||
supervisorVersion,
|
||||
};
|
||||
if (offlineMode) {
|
||||
if (offlineMode || mixpanelHost == null) {
|
||||
return;
|
||||
}
|
||||
this.client = Mixpanel.init(mixpanelToken, {
|
||||
|
Loading…
Reference in New Issue
Block a user