fix: NODE_ENV conflicts on pipelines
This commit is contained in:
committed by
mrugesh
parent
d864326d97
commit
ac50216949
@ -144,7 +144,7 @@ export default function donateBoot(app, done) {
|
|||||||
const publicInvalid = !pubKey || pubKey === 'pk_from_stipe_dashboard';
|
const publicInvalid = !pubKey || pubKey === 'pk_from_stipe_dashboard';
|
||||||
|
|
||||||
if (secretInvalid || publicInvalid) {
|
if (secretInvalid || publicInvalid) {
|
||||||
if (process.env.NODE_ENV === 'production') {
|
if (process.env.FREECODECAMP_NODE_ENV === 'production') {
|
||||||
throw new Error('Stripe API keys are required to boot the server!');
|
throw new Error('Stripe API keys are required to boot the server!');
|
||||||
}
|
}
|
||||||
console.info('No Stripe API keys were found, moving on...');
|
console.info('No Stripe API keys were found, moving on...');
|
||||||
|
@ -3,7 +3,7 @@ const createDebugger = require('debug');
|
|||||||
const log = createDebugger('fcc:boot:explorer');
|
const log = createDebugger('fcc:boot:explorer');
|
||||||
|
|
||||||
module.exports = function mountLoopBackExplorer(app) {
|
module.exports = function mountLoopBackExplorer(app) {
|
||||||
if (process.env.NODE_ENV === 'production') {
|
if (process.env.FREECODECAMP_NODE_ENV === 'production') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let explorer;
|
let explorer;
|
||||||
|
@ -12,7 +12,7 @@ let trusted = [
|
|||||||
const host = process.env.HOST || 'localhost';
|
const host = process.env.HOST || 'localhost';
|
||||||
const port = process.env.SYNC_PORT || '3000';
|
const port = process.env.SYNC_PORT || '3000';
|
||||||
|
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
if (process.env.FREECODECAMP_NODE_ENV !== 'production') {
|
||||||
trusted = trusted.concat([`ws://${host}:${port}`, 'http://localhost:8000']);
|
trusted = trusted.concat([`ws://${host}:${port}`, 'http://localhost:8000']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import { homeLocation } from '../../../config/env';
|
|||||||
|
|
||||||
import { unwrapHandledError } from '../utils/create-handled-error.js';
|
import { unwrapHandledError } from '../utils/create-handled-error.js';
|
||||||
|
|
||||||
const isDev = process.env.NODE_ENV !== 'production';
|
const isDev = process.env.FREECODECAMP_NODE_ENV !== 'production';
|
||||||
|
|
||||||
export default function prodErrorHandler() {
|
export default function prodErrorHandler() {
|
||||||
// error handling in production.
|
// error handling in production.
|
||||||
|
@ -27,13 +27,16 @@ ${JSON.stringify(error, null, 2)}
|
|||||||
};
|
};
|
||||||
|
|
||||||
export function reportError(err) {
|
export function reportError(err) {
|
||||||
return process.env.NODE_ENV === 'production'
|
return process.env.FREECODECAMP_NODE_ENV === 'production'
|
||||||
? reporter.error(err.message, err)
|
? reporter.error(err.message, err)
|
||||||
: console.error(err);
|
: console.error(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function errrorReporter() {
|
export default function errrorReporter() {
|
||||||
if (process.env.NODE_ENV !== 'production' && process.env.ERROR_REPORTER) {
|
if (
|
||||||
|
process.env.FREECODECAMP_NODE_ENV !== 'production' &&
|
||||||
|
process.env.ERROR_REPORTER
|
||||||
|
) {
|
||||||
return (err, req, res, next) => {
|
return (err, req, res, next) => {
|
||||||
console.error(errTemplate(err, req));
|
console.error(errTemplate(err, req));
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import {
|
|||||||
getFirstChallenge as _getFirstChallenge
|
getFirstChallenge as _getFirstChallenge
|
||||||
} from '../../common/utils/map.js';
|
} from '../../common/utils/map.js';
|
||||||
|
|
||||||
const isDev = process.env.NODE_ENV !== 'production';
|
const isDev = process.env.FREECODECAMP_NODE_ENV !== 'production';
|
||||||
const isBeta = !!process.env.BETA;
|
const isBeta = !!process.env.BETA;
|
||||||
const challengesRegex = /^(bonfire|waypoint|zipline|basejump|checkpoint)/i;
|
const challengesRegex = /^(bonfire|waypoint|zipline|basejump|checkpoint)/i;
|
||||||
const addNameIdMap = _.once(_addNameIdToMap);
|
const addNameIdMap = _.once(_addNameIdToMap);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const isDev = process.env.NODE_ENV !== 'production';
|
const isDev = process.env.FREECODECAMP_NODE_ENV !== 'production';
|
||||||
const isBeta = !!process.env.BETA;
|
const isBeta = !!process.env.BETA;
|
||||||
|
|
||||||
export function getEmailSender() {
|
export function getEmailSender() {
|
||||||
|
@ -149,7 +149,9 @@ exports.onCreateWebpackConfig = ({ stage, plugins, actions }) => {
|
|||||||
),
|
),
|
||||||
STRIPE_PUBLIC_KEY: JSON.stringify(process.env.STRIPE_PUBLIC_KEY || ''),
|
STRIPE_PUBLIC_KEY: JSON.stringify(process.env.STRIPE_PUBLIC_KEY || ''),
|
||||||
ROLLBAR_CLIENT_ID: JSON.stringify(process.env.ROLLBAR_CLIENT_ID || ''),
|
ROLLBAR_CLIENT_ID: JSON.stringify(process.env.ROLLBAR_CLIENT_ID || ''),
|
||||||
ENVIRONMENT: JSON.stringify(process.env.NODE_ENV || 'development'),
|
ENVIRONMENT: JSON.stringify(
|
||||||
|
process.env.FREECODECAMP_NODE_ENV || 'development'
|
||||||
|
),
|
||||||
PAYPAL_SUPPORTERS: JSON.stringify(process.env.PAYPAL_SUPPORTERS || 404)
|
PAYPAL_SUPPORTERS: JSON.stringify(process.env.PAYPAL_SUPPORTERS || 404)
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
if (process.env.FREECODECAMP_NODE_ENV !== 'production') {
|
||||||
const envPath = path.resolve(__dirname, '../.env');
|
const envPath = path.resolve(__dirname, '../.env');
|
||||||
require('dotenv').config({ path: envPath });
|
require('dotenv').config({ path: envPath });
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ const { createRedirects } = require('./create-redirects');
|
|||||||
|
|
||||||
const log = debug('fcc:tools:ensure-env');
|
const log = debug('fcc:tools:ensure-env');
|
||||||
|
|
||||||
const { NODE_ENV } = process.env;
|
const { FREECODECAMP_NODE_ENV } = process.env;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
apiLocation: api,
|
apiLocation: api,
|
||||||
@ -25,7 +25,7 @@ const clientPath = path.resolve(__dirname, '../../../client');
|
|||||||
const clientStaticPath = path.resolve(clientPath, 'static');
|
const clientStaticPath = path.resolve(clientPath, 'static');
|
||||||
const globalConfigPath = path.resolve(__dirname, '../../../config');
|
const globalConfigPath = path.resolve(__dirname, '../../../config');
|
||||||
|
|
||||||
if (NODE_ENV === 'production') {
|
if (FREECODECAMP_NODE_ENV === 'production') {
|
||||||
const redirects = createRedirects({ api, news, forum });
|
const redirects = createRedirects({ api, news, forum });
|
||||||
fs.writeFile(`${clientStaticPath}/_redirects`, redirects, function(err) {
|
fs.writeFile(`${clientStaticPath}/_redirects`, redirects, function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -35,16 +35,16 @@ if (NODE_ENV === 'production') {
|
|||||||
log('_redirects written');
|
log('_redirects written');
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
log(`ignoring creation of redirect file in ${NODE_ENV}`);
|
log(`ignoring creation of redirect file in ${FREECODECAMP_NODE_ENV}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const migrationMapPath = `${apiPath}/server/resources/pathMigration.json`;
|
const migrationMapPath = `${apiPath}/server/resources/pathMigration.json`;
|
||||||
fs.access(migrationMapPath, err => {
|
fs.access(migrationMapPath, err => {
|
||||||
if (err && NODE_ENV !== 'production') {
|
if (err && FREECODECAMP_NODE_ENV !== 'production') {
|
||||||
log('creating pathMigration');
|
log('creating pathMigration');
|
||||||
return fs.writeFileSync(migrationMapPath, '{}');
|
return fs.writeFileSync(migrationMapPath, '{}');
|
||||||
}
|
}
|
||||||
if (NODE_ENV === 'production') {
|
if (FREECODECAMP_NODE_ENV === 'production') {
|
||||||
return getChallengesForLang(locale)
|
return getChallengesForLang(locale)
|
||||||
.then(createPathMigrationMap)
|
.then(createPathMigrationMap)
|
||||||
.then(map => {
|
.then(map => {
|
||||||
|
Reference in New Issue
Block a user