-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.init.ts
43 lines (40 loc) · 1.17 KB
/
config.init.ts
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
import path from "path";
export const initConfig = (appName: string) => {
const configFile = path.join(
__dirname,
"src",
"apps",
appName,
"config.json"
);
const privateConfigFile = path.join(
__dirname,
"src",
"apps",
appName,
"config.private.json"
);
let jsonData = require(configFile);
process.env.skipBaseTests = jsonData.skipBaseTests;
process.env.mailcatcher = jsonData.mailcatcher;
process.env.faker_locale = jsonData.faker_locale;
let privateData = require(privateConfigFile);
process.env.admin_user = privateData.admin_user;
process.env.admin_password = privateData.admin_password;
process.env.admin_path = privateData.url;
(() => {
switch (process.env.NODE_ENV) {
case "live":
process.env.URL = jsonData.env.live.url;
break;
case "dev":
process.env.URL = jsonData.env.dev.url;
break;
case "uat":
process.env.URL = jsonData.env.uat.url;
break;
default:
break;
}
})();
};