-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.js
31 lines (25 loc) · 814 Bytes
/
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
// requires
const _ = require("lodash");
// module variables
const config = require("./config.json");
const e = require("express");
const defaultConfig = config.development;
const environment = process.env.NODE_ENV || "dev";
const environmentConfig = config[environment];
const finalConfig = _.merge(defaultConfig, environmentConfig);
// as a best practice
// all global variables should be referenced via global. syntax
// and their names should always begin with g
global.gConfig = finalConfig;
module.exports = global.gConfig
// var xxx = JSON.stringify(global.gConfig)
// var _obj = JSON.parse(xxx)
// console.log(_obj.kafkahost)
// log global.gConfig
// console.log(
// `global.gConfig: ${JSON.stringify(
// global.gConfig,
// undefined,
// global.gConfig.json_indentation
// )}`
// );