Skip to content

Commit

Permalink
chore: fix undefined env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelstroschein committed Sep 6, 2024
1 parent fbc2cd8 commit 92a8bf7
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,18 @@ await fs.writeFile(
dirname + "/index.ts",
`
export const ENV_VARIABLES = {
PUBLIC_POSTHOG_TOKEN: "${process.env.PUBLIC_POSTHOG_TOKEN}",
PUBLIC_INLANG_SDK_SENTRY_DSN: "${process.env.PUBLIC_INLANG_SDK_SENTRY_DSN}",
SDK_VERSION: "${packageJson.version}",
PUBLIC_POSTHOG_TOKEN: ${ifDefined(process.env.PUBLIC_POSTHOG_TOKEN)},
PUBLIC_INLANG_SDK_SENTRY_DSN: ${ifDefined(
process.env.PUBLIC_INLANG_SDK_SENTRY_DSN
)},
SDK_VERSION: ${ifDefined(packageJson.version)},
}
`
);

// eslint-disable-next-line no-console
// console.log("✅ Created env variable index file.");

function ifDefined(value) {
return value ? `"${value}"` : undefined;
}

0 comments on commit 92a8bf7

Please sign in to comment.