From 7536473c9d00fe51ba3b2ac3c3e7a8cff63d50ce Mon Sep 17 00:00:00 2001 From: zomars Date: Thu, 2 Jun 2022 14:06:13 -0600 Subject: [PATCH] Allows telemetry opt-out --- .env.example | 4 ++-- apps/web/lib/telemetry.ts | 16 +++++++++------- packages/types/environment.d.ts | 2 +- turbo.json | 3 ++- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.env.example b/.env.example index c502690bb2..99b6d22a78 100644 --- a/.env.example +++ b/.env.example @@ -54,8 +54,8 @@ NEXTAUTH_SECRET= # Used for cross-domain cookie authentication NEXTAUTH_COOKIE_DOMAIN=.example.com -# Remove those vars if you don't want Cal to collect anonymous usage -TELEMETRY_KEY=s2s.2pvs2bbpqq1zxna97wcml.3jdhd69y09dzku3x243ive +# Set this to '1' if you don't want Cal to collect anonymous usage +CALCOM_TELEMETRY_DISABLED= # ApiKey for cronjobs CRON_API_KEY='0cc0e6c35519bba620c9360cfe3e68d0' diff --git a/apps/web/lib/telemetry.ts b/apps/web/lib/telemetry.ts index 4c7b0ac170..7912b436ef 100644 --- a/apps/web/lib/telemetry.ts +++ b/apps/web/lib/telemetry.ts @@ -35,13 +35,15 @@ export function collectPageParameters( export const nextCollectBasicSettings: EventSinkOpts = { drivers: [ - process.env.TELEMETRY_KEY && { - type: "jitsu", - opts: { - key: process.env.TELEMETRY_KEY, - server: "https://t.calendso.com", - }, - }, + process.env.CALCOM_TELEMETRY_DISABLED !== "1" + ? { + type: "jitsu", + opts: { + key: "s2s.2pvs2bbpqq1zxna97wcml.esb6cikfrf7yn0qoh1nj1", + server: "https://t.calendso.com", + }, + } + : undefined, process.env.TELEMETRY_DEBUG && { type: "echo", opts: { disableColor: true } }, ], eventTypes: [ diff --git a/packages/types/environment.d.ts b/packages/types/environment.d.ts index e5fe30c69c..790e05eab8 100644 --- a/packages/types/environment.d.ts +++ b/packages/types/environment.d.ts @@ -12,6 +12,7 @@ declare namespace NodeJS { readonly NEXT_PUBLIC_LICENSE_CONSENT: "agree" | undefined; /** Needed to enable enterprise-only features */ readonly CALCOM_LICENSE_KEY: string | undefined; + readonly CALCOM_TELEMETRY_DISABLED: string | undefined; readonly CALENDSO_ENCRYPTION_KEY: string | undefined; readonly DATABASE_URL: string | undefined; readonly GOOGLE_API_CREDENTIALS: string | undefined; @@ -22,7 +23,6 @@ declare namespace NodeJS { /** @deprecated use `NEXT_PUBLIC_WEBSITE_URL` */ readonly NEXT_PUBLIC_APP_URL: string | undefined; readonly NEXTAUTH_SECRET: string | undefined; - readonly TELEMETRY_KEY: string | undefined; readonly MS_GRAPH_CLIENT_ID: string | undefined; readonly MS_GRAPH_CLIENT_SECRET: string | undefined; readonly ZOOM_CLIENT_ID: string | undefined; diff --git a/turbo.json b/turbo.json index 3084ff780e..48ffaff483 100644 --- a/turbo.json +++ b/turbo.json @@ -25,6 +25,8 @@ "^build", "@calcom/prisma#build", "$CALENDSO_ENCRYPTION_KEY", + "$CALCOM_LICENSE_KEY", + "$CALCOM_TELEMETRY_DISABLED", "$CRON_API_KEY", "$DAILY_API_KEY", "$DAILY_SCALE_PLAN", @@ -65,7 +67,6 @@ "$TANDEM_BASE_URL", "$TANDEM_CLIENT_ID", "$TANDEM_CLIENT_SECRET", - "$TELEMETRY_KEY", "$ZOOM_CLIENT_ID", "$ZOOM_CLIENT_SECRET" ],