fix: remove all extraneous env vars (#39443)
This commit is contained in:
committed by
GitHub
parent
cdc1a63ca8
commit
33de8a03b5
@@ -2,36 +2,18 @@ const fs = require('fs');
|
||||
const path = require('path');
|
||||
const debug = require('debug');
|
||||
|
||||
const env = require('../../../config/env');
|
||||
const log = debug('fcc:tools:ensure-env');
|
||||
|
||||
const env = require('../../../config/env');
|
||||
const { getChallengesForLang } = require('../../../curriculum/getChallenges');
|
||||
const { createPathMigrationMap } = require('../seed/createPathMigrationMap');
|
||||
|
||||
const { createRedirects } = require('./create-redirects');
|
||||
|
||||
const log = debug('fcc:tools:ensure-env');
|
||||
|
||||
const { FREECODECAMP_NODE_ENV } = process.env;
|
||||
|
||||
const { apiLocation: api, locale, forumProxy, newsProxy } = env;
|
||||
|
||||
const apiPath = path.resolve(__dirname, '../../../api-server');
|
||||
const clientPath = path.resolve(__dirname, '../../../client');
|
||||
const clientStaticPath = path.resolve(clientPath, 'static');
|
||||
const globalConfigPath = path.resolve(__dirname, '../../../config');
|
||||
|
||||
if (FREECODECAMP_NODE_ENV === 'production') {
|
||||
const redirects = createRedirects({ api, newsProxy, forumProxy });
|
||||
fs.writeFile(`${clientStaticPath}/_redirects`, redirects, function(err) {
|
||||
if (err) {
|
||||
log('Error');
|
||||
console.error(err);
|
||||
}
|
||||
log('_redirects written');
|
||||
});
|
||||
} else {
|
||||
log(`ignoring creation of redirect file in ${FREECODECAMP_NODE_ENV}`);
|
||||
}
|
||||
const { FREECODECAMP_NODE_ENV } = process.env;
|
||||
const { locale } = env;
|
||||
|
||||
const migrationMapPath = `${apiPath}/server/resources/pathMigration.json`;
|
||||
fs.access(migrationMapPath, err => {
|
||||
|
Reference in New Issue
Block a user