-
Notifications
You must be signed in to change notification settings - Fork 3
/
next.config.js
40 lines (35 loc) · 905 Bytes
/
next.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
console.log(process.version);
require('./node_env');
const fs = require('fs');
const {
GRAPHQL_ENDPOINT,
NODE_ENV,
SKIP_INVALID_REMOTES,
UNCHAINED_ENDPOINT,
UNCHAINED_CREATE_THEME,
DISABLE_EMAIL_PROCESSES,
} = process.env;
const theme = JSON.parse(UNCHAINED_CREATE_THEME);
// localizations
const localizations = Object.fromEntries(
Object.keys(theme.locales).map((locale) => {
const text = fs.readFileSync(`.${theme.locales[locale]}`);
return [locale, JSON.parse(text)];
}),
);
module.exports = {
serverRuntimeConfig: {},
publicRuntimeConfig: {
GRAPHQL_ENDPOINT,
NODE_ENV,
SKIP_INVALID_REMOTES: JSON.parse(SKIP_INVALID_REMOTES || 'false'),
UNCHAINED_ENDPOINT,
theme,
localizations,
disableEmailSupport: !!DISABLE_EMAIL_PROCESSES,
},
i18n: {
locales: Object.keys(theme.locales),
defaultLocale: Object.keys(theme.locales)[0],
},
};