Add opt-out backend telemetry and fix dev compose frontend envars

This commit is contained in:
Tuan Dang
2022-11-23 19:25:48 -05:00
parent b0eff2a9d3
commit 7e4b38a2f1
7 changed files with 47 additions and 22 deletions
+15
View File
@@ -0,0 +1,15 @@
import { PostHog } from 'posthog-node';
import { NODE_ENV, POSTHOG_HOST, POSTHOG_PROJECT_API_KEY, TELEMETRY_ENABLED } from '../config';
let postHogClient: any;
if (
NODE_ENV === 'production'
&& TELEMETRY_ENABLED
) {
// case: enable opt-out telemetry in production
postHogClient = new PostHog(POSTHOG_PROJECT_API_KEY, {
host: POSTHOG_HOST
});
}
export default postHogClient;
+5
View File
@@ -0,0 +1,5 @@
import postHogClient from './PostHogClient';
export {
postHogClient
}