-
Notifications
You must be signed in to change notification settings - Fork 8
/
gatsby-config.js
96 lines (92 loc) · 2.37 KB
/
gatsby-config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// used for multiple environments. This allows us to use `gatsby build` with
// different configurations instead of just 'production'
// eg.
// $ ACTIVE_ENV=<env_name> npm run build
const activeEnv = process.env.ACTIVE_ENV || process.env.NODE_ENV || 'development';
const path = require('path');
require('dotenv').config({
path: `.env.${activeEnv}`,
});
let pagesApiUrl;
// All env vars will be passed in as strings
if (process.env.UNBRANDED_LANDING_PAGE === 'True') {
pagesApiUrl = `${process.env.DESIGNER_BASE_URL}/api/v1/pages/?type=pages.ProgramPage`;
} else {
pagesApiUrl = `${process.env.DESIGNER_BASE_URL}/api/v1/pages/?hostname=${process.env.HOSTNAME}&type=pages.ProgramPage`;
}
module.exports = {
pathPrefix: `${process.env.ENABLE_PATH_PREFIX ? process.env.HOSTNAME : '/'}`,
plugins: [
{
resolve: 'gatsby-plugin-alias-imports',
options: {
alias: {
'env.config': path.join(__dirname, './env.config.js'),
},
extensions: ['.js', '.jsx'],
},
},
{
resolve: '@edx/gatsby-source-portal-designer',
options: {
pagesApiUrl,
},
},
{
resolve: 'gatsby-plugin-sass',
options: {
sassOptions: {
includePaths: [
`${__dirname}/node_modules`,
],
},
cssLoaderOptions: {
esModule: false,
modules: {
namedExport: false,
},
},
},
},
{
resolve: 'gatsby-plugin-env-variables',
options: {
allowList: [
'BASE_URL',
'ENTERPRISE_CATALOG_MFE_URL',
'ORDERS_MFE_URL',
'LMS_BASE_URL',
'ECOMMERCE_BASE_URL',
'LOGIN_URL',
'LOGOUT_URL',
'LOGO_URL',
'LOGO_TRADEMARK_URL',
'LOGO_WHITE_URL',
'FAVICON_URL',
'CSRF_TOKEN_API_PATH',
'REFRESH_ACCESS_TOKEN_ENDPOINT',
'ACCESS_TOKEN_COOKIE_NAME',
'USER_INFO_COOKIE_NAME',
'SEGMENT_KEY',
'UNBRANDED_LANDING_PAGE',
'IDP_SLUG',
'ENABLE_PATH_PREFIX',
'ENABLE_NOTICES',
],
},
},
{
resolve: 'gatsby-plugin-google-fonts',
options: {
fonts: [
'Inter:400,500,700',
'Roboto Mono',
],
display: 'swap',
},
},
{
resolve: 'gatsby-plugin-react-helmet',
},
],
};