fix: default to .env (#40315)

This commit is contained in:
Oliver Eyton-Williams
2020-11-25 18:45:59 +01:00
committed by GitHub
parent df44da9dc2
commit ebb4e0d5cc
2 changed files with 10 additions and 7 deletions

View File

@@ -1,13 +1,11 @@
const path = require('path');
const fs = require('fs');
if (process.env.FREECODECAMP_NODE_ENV !== 'production') {
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 });
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 });
const {
HOME_LOCATION: home,