From b168cc35a03bebed22f8a97cdc3ae72e143d8ad0 Mon Sep 17 00:00:00 2001 From: Felipe Lalanne Date: Tue, 20 Sep 2022 11:16:58 -0300 Subject: [PATCH] Remove mixpanel configurations Mixpanel configurations and packages are no longer used. This removes deadcode from the supervisor. --- Dockerfile.template | 4 +- package-lock.json | 129 -------------------------------------- package.json | 1 - src/config/functions.ts | 10 --- src/config/schema-type.ts | 10 --- src/config/schema.ts | 5 -- src/lib/constants.ts | 1 - src/supervisor.ts | 2 - 8 files changed, 1 insertion(+), 161 deletions(-) diff --git a/Dockerfile.template b/Dockerfile.template index 9307cdea..e7e7aaa6 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -68,12 +68,10 @@ RUN apk add --no-cache \ ARG ARCH ARG VERSION=master -ARG DEFAULT_MIXPANEL_TOKEN=bananasbananas ENV CONFIG_MOUNT_POINT=/boot/config.json \ LED_FILE=/dev/null \ SUPERVISOR_IMAGE=balena/$ARCH-supervisor \ - VERSION=$VERSION \ - DEFAULT_MIXPANEL_TOKEN=$DEFAULT_MIXPANEL_TOKEN + VERSION=$VERSION ############################################################### # Use the base image to run integration tests and for livepush diff --git a/package-lock.json b/package-lock.json index 6df20ef4..d891784f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -78,7 +78,6 @@ "livepush": "^3.5.1", "lodash": "^4.17.21", "memoizee": "^0.4.14", - "mixpanel": "^0.10.3", "mocha": "^8.3.2", "mocha-pod": "^0.6.0", "mock-fs": "^4.14.0", @@ -2077,18 +2076,6 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, - "node_modules/agent-base": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", - "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==", - "dev": true, - "dependencies": { - "es6-promisify": "^5.0.0" - }, - "engines": { - "node": ">= 4.0.0" - } - }, "node_modules/agentkeepalive": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.1.tgz", @@ -5381,21 +5368,6 @@ "es6-symbol": "^3.1.1" } }, - "node_modules/es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", - "dev": true - }, - "node_modules/es6-promisify": { - "version": "5.0.0", - "resolved": "http://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", - "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", - "dev": true, - "dependencies": { - "es6-promise": "^4.0.3" - } - }, "node_modules/es6-symbol": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", @@ -7498,35 +7470,6 @@ "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", "dev": true }, - "node_modules/https-proxy-agent": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-3.0.0.tgz", - "integrity": "sha512-y4jAxNEihqvBI5F3SaO2rtsjIOnnNA8sEbuiP+UhJZJHeM2NRm6c09ax2tgqme+SgUUvjao2fJXF4h3D6Cb2HQ==", - "dev": true, - "dependencies": { - "agent-base": "^4.3.0", - "debug": "^3.1.0" - }, - "engines": { - "node": ">= 4.5.0" - } - }, - "node_modules/https-proxy-agent/node_modules/debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "deprecated": "Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)", - "dev": true, - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/https-proxy-agent/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, "node_modules/human-signals": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-3.0.1.tgz", @@ -9870,18 +9813,6 @@ "node": ">=0.10.0" } }, - "node_modules/mixpanel": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/mixpanel/-/mixpanel-0.10.3.tgz", - "integrity": "sha512-wIYr5o+1XSzJ80o3QED35K/yfPAKi5FigZXTSfcs4vltfeKbilIjNgwxdno7LrqzhjoSjmIyDWkI7D3lr7TwDw==", - "dev": true, - "dependencies": { - "https-proxy-agent": "3.0.0" - }, - "engines": { - "node": ">=6.9" - } - }, "node_modules/mkdirp": { "version": "0.5.5", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", @@ -18117,15 +18048,6 @@ "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", "dev": true }, - "agent-base": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", - "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==", - "dev": true, - "requires": { - "es6-promisify": "^5.0.0" - } - }, "agentkeepalive": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.1.tgz", @@ -20844,21 +20766,6 @@ "es6-symbol": "^3.1.1" } }, - "es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", - "dev": true - }, - "es6-promisify": { - "version": "5.0.0", - "resolved": "http://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", - "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", - "dev": true, - "requires": { - "es6-promise": "^4.0.3" - } - }, "es6-symbol": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", @@ -22510,33 +22417,6 @@ "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", "dev": true }, - "https-proxy-agent": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-3.0.0.tgz", - "integrity": "sha512-y4jAxNEihqvBI5F3SaO2rtsjIOnnNA8sEbuiP+UhJZJHeM2NRm6c09ax2tgqme+SgUUvjao2fJXF4h3D6Cb2HQ==", - "dev": true, - "requires": { - "agent-base": "^4.3.0", - "debug": "^3.1.0" - }, - "dependencies": { - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } - } - }, "human-signals": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-3.0.1.tgz", @@ -24376,15 +24256,6 @@ } } }, - "mixpanel": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/mixpanel/-/mixpanel-0.10.3.tgz", - "integrity": "sha512-wIYr5o+1XSzJ80o3QED35K/yfPAKi5FigZXTSfcs4vltfeKbilIjNgwxdno7LrqzhjoSjmIyDWkI7D3lr7TwDw==", - "dev": true, - "requires": { - "https-proxy-agent": "3.0.0" - } - }, "mkdirp": { "version": "0.5.5", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", diff --git a/package.json b/package.json index 83637a6d..65a9f8e8 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,6 @@ "livepush": "^3.5.1", "lodash": "^4.17.21", "memoizee": "^0.4.14", - "mixpanel": "^0.10.3", "mocha": "^8.3.2", "mocha-pod": "^0.6.0", "mock-fs": "^4.14.0", diff --git a/src/config/functions.ts b/src/config/functions.ts index 48cbf0f8..8bb7318e 100644 --- a/src/config/functions.ts +++ b/src/config/functions.ts @@ -2,7 +2,6 @@ import * as Bluebird from 'bluebird'; import * as _ from 'lodash'; import * as memoizee from 'memoizee'; import { promises as fs } from 'fs'; -import { URL } from 'url'; import supervisorVersion = require('../lib/supervisor-version'); @@ -114,15 +113,6 @@ export const fnSchema = { }; }); }, - mixpanelHost: () => { - return config.get('apiEndpoint').then((apiEndpoint) => { - if (!apiEndpoint) { - return null; - } - const url = new URL(apiEndpoint); - return { host: url.host, path: '/mixpanel' }; - }); - }, extendedEnvOptions: () => { return config.getMany([ 'uuid', diff --git a/src/config/schema-type.ts b/src/config/schema-type.ts index 6aa3ec52..13df3c7d 100644 --- a/src/config/schema-type.ts +++ b/src/config/schema-type.ts @@ -1,7 +1,5 @@ import * as t from 'io-ts'; -import * as constants from '../lib/constants'; - import { NullOrUndefined, PermissiveBoolean, @@ -66,10 +64,6 @@ export const schemaTypes = { type: PermissiveBoolean, default: true, }, - mixpanelToken: { - type: t.string, - default: constants.defaultMixpanelToken, - }, bootstrapRetryDelay: { type: PermissiveNumber, default: 30000, @@ -226,10 +220,6 @@ export const schemaTypes = { }), default: t.never, }, - mixpanelHost: { - type: t.union([t.null, t.interface({ host: t.string, path: t.string })]), - default: t.never, - }, extendedEnvOptions: { type: t.interface({ uuid: t.union([t.string, NullOrUndefined]), diff --git a/src/config/schema.ts b/src/config/schema.ts index ae7d4003..64bb6e10 100644 --- a/src/config/schema.ts +++ b/src/config/schema.ts @@ -54,11 +54,6 @@ export const schema = { mutable: true, removeIfNull: false, }, - mixpanelToken: { - source: 'config.json', - mutable: false, - removeIfNull: false, - }, bootstrapRetryDelay: { source: 'config.json', mutable: false, diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 6e7a051b..efebe689 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -41,7 +41,6 @@ const constants = { configJsonPathOnHost: checkString(process.env.CONFIG_JSON_PATH), proxyvisorHookReceiver: 'http://0.0.0.0:1337', configJsonNonAtomicPath: '/boot/config.json', - defaultMixpanelToken: process.env.DEFAULT_MIXPANEL_TOKEN, supervisorNetworkInterface, allowedInterfaces: [ 'resin-vpn', diff --git a/src/supervisor.ts b/src/supervisor.ts index 30bbcdc3..2ab3384d 100644 --- a/src/supervisor.ts +++ b/src/supervisor.ts @@ -20,8 +20,6 @@ const startupConfigFields: config.ConfigKey[] = [ 'apiTimeout', 'unmanaged', 'deviceApiKey', - 'mixpanelToken', - 'mixpanelHost', 'loggingEnabled', 'localMode', 'legacyAppsPresent',