2019-02-04 11:42:31 +00:00
|
|
|
const path = require('path');
|
|
|
|
|
2021-04-20 13:59:31 +00:00
|
|
|
const envPath = path.resolve(__dirname, '../.env');
|
|
|
|
const { error } = require('dotenv').config({ path: envPath });
|
|
|
|
|
|
|
|
if (error) {
|
2021-10-25 03:53:13 +00:00
|
|
|
console.warn(`
|
|
|
|
----------------------------------------------------
|
|
|
|
Warning: .env file not found.
|
|
|
|
----------------------------------------------------
|
|
|
|
Please copy sample.env to .env
|
|
|
|
|
|
|
|
You can ignore this warning if using a different way
|
|
|
|
to setup this environment.
|
|
|
|
----------------------------------------------------
|
|
|
|
`);
|
2019-02-04 11:42:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const {
|
2020-12-21 16:53:06 +00:00
|
|
|
HOME_LOCATION: homeLocation,
|
|
|
|
API_LOCATION: apiLocation,
|
|
|
|
FORUM_LOCATION: forumLocation,
|
|
|
|
NEWS_LOCATION: newsLocation,
|
2021-01-27 20:34:29 +00:00
|
|
|
RADIO_LOCATION: radioLocation,
|
2020-12-16 08:02:52 +00:00
|
|
|
CLIENT_LOCALE: clientLocale,
|
|
|
|
CURRICULUM_LOCALE: curriculumLocale,
|
|
|
|
SHOW_LOCALE_DROPDOWN_MENU: showLocaleDropdownMenu,
|
2019-10-04 16:03:20 +00:00
|
|
|
ALGOLIA_APP_ID: algoliaAppId,
|
2020-03-13 09:25:57 +00:00
|
|
|
ALGOLIA_API_KEY: algoliaAPIKey,
|
2021-08-08 20:22:25 +00:00
|
|
|
STRIPE_PUBLIC_KEY: stripePublicKey,
|
2020-03-23 14:03:37 +00:00
|
|
|
PAYPAL_CLIENT_ID: paypalClientId,
|
2021-11-04 16:06:24 +00:00
|
|
|
PATREON_CLIENT_ID: patreonClientId,
|
2020-09-04 19:29:29 +00:00
|
|
|
DEPLOYMENT_ENV: deploymentEnv,
|
2022-04-15 14:54:02 +00:00
|
|
|
SENTRY_CLIENT_DSN: sentryClientDSN,
|
2021-12-09 18:31:03 +00:00
|
|
|
SHOW_UPCOMING_CHANGES: showUpcomingChanges,
|
|
|
|
SHOW_NEW_CURRICULUM: showNewCurriculum
|
2019-02-04 11:42:31 +00:00
|
|
|
} = process.env;
|
|
|
|
|
|
|
|
const locations = {
|
2020-12-21 16:53:06 +00:00
|
|
|
homeLocation,
|
|
|
|
apiLocation,
|
|
|
|
forumLocation,
|
2021-01-27 20:34:29 +00:00
|
|
|
newsLocation,
|
2021-01-28 08:22:39 +00:00
|
|
|
radioLocation: !radioLocation
|
|
|
|
? 'https://coderadio.freecodecamp.org'
|
|
|
|
: radioLocation
|
2019-02-04 11:42:31 +00:00
|
|
|
};
|
|
|
|
|
2019-10-04 16:03:20 +00:00
|
|
|
module.exports = Object.assign(locations, {
|
2020-12-16 08:02:52 +00:00
|
|
|
clientLocale,
|
|
|
|
curriculumLocale,
|
|
|
|
showLocaleDropdownMenu: showLocaleDropdownMenu === 'true',
|
2020-03-23 14:03:37 +00:00
|
|
|
deploymentEnv,
|
2020-08-19 19:52:59 +00:00
|
|
|
environment: process.env.FREECODECAMP_NODE_ENV || 'development',
|
2019-10-08 08:19:43 +00:00
|
|
|
algoliaAppId:
|
2020-09-25 19:10:17 +00:00
|
|
|
!algoliaAppId || algoliaAppId === 'app_id_from_algolia_dashboard'
|
2021-08-05 20:00:30 +00:00
|
|
|
? ''
|
2019-10-08 08:19:43 +00:00
|
|
|
: algoliaAppId,
|
|
|
|
algoliaAPIKey:
|
2020-09-25 19:10:17 +00:00
|
|
|
!algoliaAPIKey || algoliaAPIKey === 'api_key_from_algolia_dashboard'
|
2021-08-05 20:00:30 +00:00
|
|
|
? ''
|
2020-03-13 09:25:57 +00:00
|
|
|
: algoliaAPIKey,
|
2021-08-08 20:22:25 +00:00
|
|
|
stripePublicKey:
|
|
|
|
!stripePublicKey || stripePublicKey === 'pk_from_stripe_dashboard'
|
|
|
|
? null
|
|
|
|
: stripePublicKey,
|
2020-03-13 09:25:57 +00:00
|
|
|
paypalClientId:
|
|
|
|
!paypalClientId || paypalClientId === 'id_from_paypal_dashboard'
|
|
|
|
? null
|
2020-09-04 19:29:29 +00:00
|
|
|
: paypalClientId,
|
2021-11-04 16:06:24 +00:00
|
|
|
patreonClientId:
|
|
|
|
!patreonClientId || patreonClientId === 'id_from_patreon_dashboard'
|
|
|
|
? null
|
|
|
|
: patreonClientId,
|
2022-04-15 14:54:02 +00:00
|
|
|
sentryClientDSN:
|
|
|
|
!sentryClientDSN || sentryClientDSN === 'dsn_from_sentry_dashboard'
|
|
|
|
? null
|
|
|
|
: sentryClientDSN,
|
2021-12-09 18:31:03 +00:00
|
|
|
showUpcomingChanges: showUpcomingChanges === 'true',
|
|
|
|
showNewCurriculum: showNewCurriculum === 'true'
|
2019-10-04 16:03:20 +00:00
|
|
|
});
|