1 | var _ = require("lodash");
|
2 |
|
3 | module.exports = function (env, nodeConfigAdditions) {
|
4 | var nodeConfig = env.NODE_CONFIG;
|
5 |
|
6 | if (typeof nodeConfig === "string") {
|
7 | try {
|
8 | nodeConfig = JSON.parse(nodeConfig);
|
9 | } catch (e) {
|
10 | // bad node config. Just start a new one
|
11 | nodeConfig = {};
|
12 | }
|
13 | }
|
14 |
|
15 | if (nodeConfig && typeof nodeConfig === "object") {
|
16 | // already an object {}
|
17 | } else {
|
18 | nodeConfig = {};
|
19 | }
|
20 |
|
21 | return _.extend(nodeConfig, nodeConfigAdditions);
|
22 | }; |
\ | No newline at end of file |