Add posthog api key back in (it's ok to have it exposed), and always load env.local if it exists

This commit is contained in:
afik.cohen 2024-01-25 16:38:04 -08:00
parent 048287a9ff
commit 23e994e193
2 changed files with 6 additions and 7 deletions

View file

@ -1,7 +1,5 @@
import { PostHog } from "posthog-node" // new
const phProjectApiKey = process.env.POSTHOG_PROJECT_API_KEY
if (phProjectApiKey === undefined) {
throw new Error("POSTHOG_PROJECT_API_KEY is not defined in your environment or in .env.local")
}
export const posthog = new PostHog(phProjectApiKey, { host: "https://app.posthog.com" })
export const posthog = new PostHog("phc_aUO790jHd7z1SXwsYCz8dRApxueplZlZWeDSpKc5hol", {
host: "https://app.posthog.com",
})

View file

@ -1,7 +1,8 @@
import dotenv from "dotenv"
import * as console from "console"
import console from "console"
import fs from "fs"
if (process.env.NODE_ENV !== "production") {
if (fs.existsSync(".env.local")) {
console.log("Using .env.local file to supply config environment variables")
dotenv.config({ path: ".env.local" })
}