diff --git a/config/env.js b/config/env.js index d86994f441..6cf66ec129 100644 --- a/config/env.js +++ b/config/env.js @@ -1,11 +1,14 @@ const path = require('path'); const fs = require('fs'); -const envPath = path.resolve(__dirname, '../.env'); -if (!fs.existsSync(envPath)) { - throw Error('.env not found, please copy sample.env to .env.'); +// PIPELINE_ENV is 'true' in the build pipeline +if (process.env.PIPELINE_ENV !== 'true') { + const envPath = path.resolve(__dirname, '../.env'); + if (!fs.existsSync(envPath)) { + throw Error('.env not found, please copy sample.env to .env.'); + } + require('dotenv').config({ path: envPath }); } -require('dotenv').config({ path: envPath }); const { HOME_LOCATION: home, diff --git a/sample.env b/sample.env index d27ec0a2c8..5a5a285d3f 100644 --- a/sample.env +++ b/sample.env @@ -43,6 +43,7 @@ PAYPAL_WEBHOOK_ID=webhook_id_from_paypal_dashboard # --------------------- # Build variants # --------------------- +PIPELINE_ENV=false DEPLOYMENT_ENV='staging' FREECODECAMP_NODE_ENV='development' # Language to build