From e4ea9e608dd1b994733d054d766c747098bda70d Mon Sep 17 00:00:00 2001 From: Michael Shanks Date: Tue, 29 Sep 2020 17:28:24 +0100 Subject: [PATCH] Analytics enabled/disabled via specific ENV variable --- packages/builder/cypress/setup.js | 1 + packages/server/.env.template | 3 ++- packages/server/src/api/controllers/analytics.js | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/builder/cypress/setup.js b/packages/builder/cypress/setup.js index 1003e6e422..a6dab69583 100644 --- a/packages/builder/cypress/setup.js +++ b/packages/builder/cypress/setup.js @@ -14,6 +14,7 @@ rimraf.sync(homedir) process.env.BUDIBASE_API_KEY = "6BE826CB-6B30-4AEC-8777-2E90464633DE" process.env.NODE_ENV = "cypress" +process.env.ENABLE_ANALYTICS = "false" initialiseBudibase({ dir: homedir, clientId: "cypress-test" }) .then(() => { diff --git a/packages/server/.env.template b/packages/server/.env.template index 165e317b07..4895d0309c 100644 --- a/packages/server/.env.template +++ b/packages/server/.env.template @@ -16,4 +16,5 @@ LOG_LEVEL=error DEPLOYMENT_CREDENTIALS_URL="https://dt4mpwwap8.execute-api.eu-west-1.amazonaws.com/prod/" DEPLOYMENT_DB_URL="https://couchdb.budi.live:5984" -SENTRY_DSN=https://a34ae347621946bf8acded18e5b7d4b8@o420233.ingest.sentry.io/5338131 \ No newline at end of file +SENTRY_DSN=https://a34ae347621946bf8acded18e5b7d4b8@o420233.ingest.sentry.io/5338131 +ENABLE_ANALYTICS="true" \ No newline at end of file diff --git a/packages/server/src/api/controllers/analytics.js b/packages/server/src/api/controllers/analytics.js index 827f83c8ff..025775ac2e 100644 --- a/packages/server/src/api/controllers/analytics.js +++ b/packages/server/src/api/controllers/analytics.js @@ -1,3 +1,3 @@ exports.isEnabled = async function(ctx) { - ctx.body = JSON.stringify(process.env.NODE_ENV === "production") + ctx.body = JSON.stringify(process.env.ENABLE_ANALYTICS === "true") }