config 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/History.md CHANGED
@@ -1,3 +1,9 @@
1
+ 2.0.2 / 2018-08-28
2
+ ==================
3
+
4
+ * Added dot notation to setModuleDefaults - bertho-zero
5
+ * Updated copyright year - JemiloII
6
+
1
7
  2.0.1 / 2018-07-26
2
8
  ==================
3
9
 
package/README.md CHANGED
@@ -171,6 +171,6 @@ License
171
171
 
172
172
  May be freely distributed under the [MIT license](https://raw.githubusercontent.com/lorenwest/node-config/master/LICENSE).
173
173
 
174
- Copyright (c) 2010-2015 Loren West
174
+ Copyright (c) 2010-2018 Loren West
175
175
  [and other contributors](https://github.com/lorenwest/node-config/graphs/contributors)
176
176
 
package/lib/config.js CHANGED
@@ -276,17 +276,18 @@ util.setModuleDefaults = function (moduleName, defaultProperties) {
276
276
  parsed: {}
277
277
  });
278
278
  }
279
- configSources[0].parsed[moduleName] = {};
280
- util.extendDeep(configSources[0].parsed[moduleName], defaultProperties);
279
+ util.setPath(configSources[0].parsed, moduleName.split('.'), {});
280
+ util.extendDeep(getImpl(configSources[0].parsed, moduleName), defaultProperties);
281
281
 
282
282
  // Create a top level config for this module if it doesn't exist
283
- t[moduleName] = t[moduleName] || {};
283
+ util.setPath(t, moduleName.split('.'), getImpl(t, moduleName) || {});
284
284
 
285
285
  // Extend local configurations into the module config
286
- util.extendDeep(moduleConfig, t[moduleName]);
286
+ util.setPath(moduleConfig, moduleName.split('.'), getImpl(moduleConfig, moduleName) || {});
287
+ util.extendDeep(moduleConfig, getImpl(t, moduleName));
287
288
 
288
289
  // Merge the extended configs without replacing the original
289
- util.extendDeep(t[moduleName], moduleConfig);
290
+ util.extendDeep(getImpl(t, moduleName), moduleConfig);
290
291
 
291
292
  // reset the mutability check for "config.get" method.
292
293
  // we are not making t[moduleName] immutable immediately,
@@ -296,7 +297,7 @@ util.setModuleDefaults = function (moduleName, defaultProperties) {
296
297
  }
297
298
 
298
299
  // Attach handlers & watchers onto the module config object
299
- return util.attachProtoDeep(t[moduleName]);
300
+ return util.attachProtoDeep(getImpl(t, moduleName));
300
301
  };
301
302
 
302
303
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "config",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "main": "./lib/config.js",
5
5
  "description": "Configuration control for production node deployments",
6
6
  "author": "Loren West <open_source@lorenwest.com>",