2023-08-18 20:05:14 +10:00
|
|
|
import { PostHog } from 'posthog-node';
|
|
|
|
|
|
|
|
|
|
import { extractPostHogConfig } from '@documenso/lib/constants/feature-flags';
|
|
|
|
|
|
|
|
|
|
export default function PostHogServerClient() {
|
|
|
|
|
const postHogConfig = extractPostHogConfig();
|
|
|
|
|
|
|
|
|
|
if (!postHogConfig) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new PostHog(postHogConfig.key, {
|
|
|
|
|
host: postHogConfig.host,
|
2023-08-29 13:01:19 +10:00
|
|
|
fetch: async (...args) => fetch(...args),
|
2023-08-18 20:05:14 +10:00
|
|
|
});
|
|
|
|
|
}
|