Skip to content

Same agent Smaller bill. The tools and infrastructure to get more work from your AI. Fewer tokens. Less compute. Lower cost.

[Fix]: Telemetry environment variable fixed for acces on client and server (#525)

Aman Agarwal2deaf473c4d2
diff --git a/src/client/next.config.js b/src/client/next.config.js
index 0fd42cbb..d437c957 100644
--- a/src/client/next.config.js
+++ b/src/client/next.config.js
@@ -1,9 +1,9 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
env: {
- TELEMETRY_ENABLED: process.env.TELEMETRY_ENABLED,
- POSTHOG_API_KEY: process.env.POSTHOG_API_KEY,
- POSTHOG_API_HOST: process.env.POSTHOG_API_HOST,
+ NEXT_PUBLIC_TELEMETRY_ENABLED: process.env.TELEMETRY_ENABLED,
+ NEXT_PUBLIC_POSTHOG_API_KEY: process.env.POSTHOG_API_KEY,
+ NEXT_PUBLIC_POSTHOG_API_HOST: process.env.POSTHOG_API_HOST,
},
images: {
remotePatterns: [
diff --git a/src/client/package-lock.json b/src/client/package-lock.json
index 3045073e..cf9a43b5 100644
--- a/src/client/package-lock.json
+++ b/src/client/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "openlit",
- "version": "1.11.4",
+ "version": "1.11.5",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "openlit",
- "version": "1.11.4",
+ "version": "1.11.5",
"dependencies": {
"@anthropic-ai/sdk": "^0.21.1",
"@clickhouse/client": "^1.1.0",
diff --git a/src/client/package.json b/src/client/package.json
index 7c3ccc39..ef9d0aac 100644
--- a/src/client/package.json
+++ b/src/client/package.json
@@ -1,6 +1,6 @@
{
"name": "openlit",
- "version": "1.11.4",
+ "version": "1.11.5",
"private": true,
"scripts": {
"dev": "next dev",
diff --git a/src/client/src/components/(playground)/posthog.tsx b/src/client/src/components/(playground)/posthog.tsx
index 886d2356..0f0641ea 100644
--- a/src/client/src/components/(playground)/posthog.tsx
+++ b/src/client/src/components/(playground)/posthog.tsx
@@ -3,8 +3,7 @@ import { PostHogProvider } from "posthog-js/react";
import { ReactNode } from "react";
const POSTHOG_OPTIONS: Partial<PostHogConfig> = {
- api_host: process.env.POSTHOG_API_HOST,
- // debug: process.env.NODE_ENV !== "production",
+ api_host: process.env.NEXT_PUBLIC_POSTHOG_API_HOST,
autocapture: false,
};
@@ -13,10 +12,10 @@ export default function CustomPostHogProvider({
}: {
children: ReactNode;
}) {
- if (process.env.TELEMETRY_ENABLED) {
+ if (process.env.NEXT_PUBLIC_TELEMETRY_ENABLED) {
return (
<PostHogProvider
- apiKey={process.env.POSTHOG_API_KEY}
+ apiKey={process.env.NEXT_PUBLIC_POSTHOG_API_KEY}
options={POSTHOG_OPTIONS}
>
{children}
diff --git a/src/client/src/lib/posthog.ts b/src/client/src/lib/posthog.ts
index 6a846b36..bca6e6f1 100644
--- a/src/client/src/lib/posthog.ts
+++ b/src/client/src/lib/posthog.ts
@@ -6,8 +6,8 @@ type EventMessage = Parameters<PostHog["capture"]>[0];
export default class PostHogServer {
static client: PostHog;
static createClient() {
- this.client = new PostHog(process.env.POSTHOG_API_KEY!, {
- host: process.env.POSTHOG_API_HOST,
+ this.client = new PostHog(process.env.NEXT_PUBLIC_POSTHOG_API_KEY!, {
+ host: process.env.NEXT_PUBLIC_POSTHOG_API_HOST,
flushAt: 1,
flushInterval: 0,
});
@@ -15,7 +15,7 @@ export default class PostHogServer {
static capture(options: EventMessage) {
try {
- if (process.env.TELEMETRY_ENABLED) {
+ if (process.env.NEXT_PUBLIC_TELEMETRY_ENABLED) {
if (!this.client) {
this.createClient();
}