fix: update env validation and include newest var (#39661)
This commit is contained in:
parent
d33f5f82a7
commit
4f68cc3126
@ -50,5 +50,5 @@ module.exports = Object.assign(locations, {
|
|||||||
!paypalClientId || paypalClientId === 'id_from_paypal_dashboard'
|
!paypalClientId || paypalClientId === 'id_from_paypal_dashboard'
|
||||||
? null
|
? null
|
||||||
: paypalClientId,
|
: paypalClientId,
|
||||||
showUpcomingChanges: showUpcomingChanges === 'true'
|
showUpcomingChanges: showUpcomingChanges && showUpcomingChanges === 'true'
|
||||||
});
|
});
|
||||||
|
@ -15,7 +15,12 @@ if (FREECODECAMP_NODE_ENV === 'production') {
|
|||||||
'forumLocation',
|
'forumLocation',
|
||||||
'newsLocation'
|
'newsLocation'
|
||||||
];
|
];
|
||||||
const deploymentKeys = ['locale', 'deploymentEnv', 'environment'];
|
const deploymentKeys = [
|
||||||
|
'locale',
|
||||||
|
'deploymentEnv',
|
||||||
|
'environment',
|
||||||
|
'showUpcomingChanges'
|
||||||
|
];
|
||||||
const searchKeys = ['algoliaAppId', 'algoliaAPIKey'];
|
const searchKeys = ['algoliaAppId', 'algoliaAPIKey'];
|
||||||
const donationKeys = ['stripePublicKey', 'paypalClientId'];
|
const donationKeys = ['stripePublicKey', 'paypalClientId'];
|
||||||
|
|
||||||
@ -29,13 +34,14 @@ if (FREECODECAMP_NODE_ENV === 'production') {
|
|||||||
variables.sort();
|
variables.sort();
|
||||||
if (expectedVariables.length !== variables.length) {
|
if (expectedVariables.length !== variables.length) {
|
||||||
throw Error(`Env. variable validation failed. Expected
|
throw Error(`Env. variable validation failed. Expected
|
||||||
${variables} to match
|
|
||||||
${expectedVariables}
|
${expectedVariables}
|
||||||
|
but recieved
|
||||||
|
${variables}
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key of expectedVariables) {
|
for (const key of expectedVariables) {
|
||||||
if (!env[key]) {
|
if (typeof env[key] === 'undefined' || env[key] === null) {
|
||||||
throw Error(`Env. variable ${key} is missing, build cannot continue`);
|
throw Error(`Env. variable ${key} is missing, build cannot continue`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user