feat: Toggle telemetry with telemetry enabled env variable

This commit is contained in:
Faruk AYDIN
2022-09-21 01:31:33 +03:00
committed by Ali BARIN
parent 6a8c642b72
commit 4d7ee3dcca
2 changed files with 6 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ type AppConfig = {
redisHost: string; redisHost: string;
redisPort: number; redisPort: number;
enableBullMQDashboard: boolean; enableBullMQDashboard: boolean;
telemetryEnabled: boolean;
}; };
const host = process.env.HOST || 'localhost'; const host = process.env.HOST || 'localhost';
@@ -62,6 +63,7 @@ const appConfig: AppConfig = {
process.env.ENABLE_BULLMQ_DASHBOARD === 'true' ? true : false, process.env.ENABLE_BULLMQ_DASHBOARD === 'true' ? true : false,
baseUrl, baseUrl,
webAppUrl, webAppUrl,
telemetryEnabled: process.env.TELEMETRY_ENABLED === 'false' ? false : true,
}; };
if (!appConfig.encryptionKey) { if (!appConfig.encryptionKey) {

View File

@@ -26,6 +26,10 @@ class Telemetry {
} }
track(name: string, properties: apiObject) { track(name: string, properties: apiObject) {
if (!appConfig.telemetryEnabled) {
return;
}
properties = { properties = {
...properties, ...properties,
appEnv: appConfig.appEnv, appEnv: appConfig.appEnv,