fix: ignore .env in pipelines (#40327)

This commit is contained in:
Oliver Eyton-Williams
2020-11-27 16:32:50 +01:00
committed by GitHub
parent 6c5304980d
commit 24f57ca7c2
2 changed files with 8 additions and 4 deletions

View File

@ -1,11 +1,14 @@
const path = require('path'); const path = require('path');
const fs = require('fs'); const fs = require('fs');
const envPath = path.resolve(__dirname, '../.env'); // PIPELINE_ENV is 'true' in the build pipeline
if (!fs.existsSync(envPath)) { 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.'); throw Error('.env not found, please copy sample.env to .env.');
}
require('dotenv').config({ path: envPath });
} }
require('dotenv').config({ path: envPath });
const { const {
HOME_LOCATION: home, HOME_LOCATION: home,

View File

@ -43,6 +43,7 @@ PAYPAL_WEBHOOK_ID=webhook_id_from_paypal_dashboard
# --------------------- # ---------------------
# Build variants # Build variants
# --------------------- # ---------------------
PIPELINE_ENV=false
DEPLOYMENT_ENV='staging' DEPLOYMENT_ENV='staging'
FREECODECAMP_NODE_ENV='development' FREECODECAMP_NODE_ENV='development'
# Language to build # Language to build