-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.js
36 lines (33 loc) · 1.14 KB
/
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
import { promises as fs } from 'fs';
const noConfig = (variable) => {
console.error(
`Required configuration variable '${variable}' is not set.\nTerminating.`
);
process.exit(1);
};
const getConfig = async () => {
let env = {};
try {
env = JSON.parse(
await fs.readFile('../configurations/envs/arvind.io.config.json')
);
} catch (err) {
console.warn(err);
}
// Set the corresponding configuration variables, or replace the values here.
return {
TITLE: env.title || process.env.TITLE || noConfig('title'), // Required
AUTHOR: env.author || process.env.AUTHOR || noConfig('author'), // Required
URL: env.url || process.env.URL || noConfig('url'), // Required
EMAIL: env.email || process.env.EMAIL || noConfig('email'), // Required
DESCRIPTION:
env.description || process.env.DESCRIPTION || noConfig('description'), // Required
UMAMISITEID:
env.umamiSiteID || process.env.UMAMISITEID || noConfig('umamiSiteID'), // Required
DISQUSSHORTNAME:
env.disqusShortname ||
process.env.DISQUSSHORTNAME ||
noConfig('disqusShortname') // Required
};
};
export default getConfig;