UNPKG

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