Skip to content

Commit

Permalink
L-1016 By default, don't check ENV vars in Vercel non-production build (
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrHeinz authored Nov 28, 2023
1 parent ee493db commit 784603f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/withLogtail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ declare global {
}

function warnAboutMissingEnvironmentVariables() {
const nodeEnvironment = process.env.NODE_ENV;
const vercelEnvironment = process.env.VERCEL_ENV;
let checkEnabled =
nodeEnvironment !== 'development' && vercelEnvironment !== 'preview' && vercelEnvironment !== 'development';
const nodeDevEnv = process.env.NODE_ENV === 'development';
const vercelDevEnv = process.env.VERCEL_ENV === 'preview' || process.env.VERCEL_ENV === 'development';
const vercelNonProdBuild = process.env.VERCEL_ENV !== 'production' && process.env.__VERCEL_BUILD_RUNNING === '1';
let checkEnabled = !nodeDevEnv && !vercelDevEnv && !vercelNonProdBuild;
if (process.env.LOGTAIL_CHECK_ENV_VARS?.toLowerCase() === 'true' || process.env.LOGTAIL_CHECK_ENV_VARS === '1') {
checkEnabled = true;
}
Expand Down

0 comments on commit 784603f

Please sign in to comment.