config 1.26.1 → 1.28.1

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,24 @@
1
+ 1.28.1 / 2017-11-09
2
+ ===================
3
+
4
+ * add nodejs9 to travisci - jfelege
5
+
6
+ 1.28.0 / 2017-11-07
7
+ ===================
8
+
9
+ * allow overrides of `NODE_ENV` with `NODE_CONFIG_ENV` - jfelege
10
+
11
+ 1.27.0 / 2017-10-17
12
+ ===================
13
+
14
+ * Add method to output plain JS object - willsoto
15
+ * Updated Node versions in Travis CI - lorenwest
16
+
17
+ 1.26.2 / 2017-08-11
18
+ ===================
19
+
20
+ * Update supported nodejs platforms - jfelege
21
+
1
22
  1.26.1 / 2017-05-03
2
23
  ===================
3
24
 
@@ -0,0 +1,24 @@
1
+ **Note: for support questions, please use [StackOverflow](https://stackoverflow.com/questions/tagged/node-config) and tag your question with `node-config`**. *This repository's issues are reserved for feature requests and bug reports.*
2
+
3
+ Before submitting a bug report, please search the issue tracker the wiki first. Many issues have already been discussed.
4
+
5
+ The wiki is located at: https://github.com/lorenwest/node-config/wiki
6
+
7
+ ### I'm submitting a ...
8
+ - [ ] bug report
9
+ - [ ] feature request
10
+ - [ ] support request or question => Please do not submit support request or questions here, see note at the top of this template.
11
+
12
+ ### What is the current behavior?
13
+ *If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem*:
14
+
15
+ ### What is the expected behavior?
16
+
17
+ ### Please tell us about your environment:
18
+
19
+ - node-config version: x.x.x
20
+ - node-version: x.x.x
21
+
22
+ ### Other information
23
+
24
+ (e.g. are you using an environment besides Node.js?)
package/README.md CHANGED
@@ -124,7 +124,7 @@ Articles
124
124
 
125
125
  Contributors
126
126
  ------------
127
- <table id="contributors"><tr><td><img src=https://avatars1.githubusercontent.com/u/373538?v=3><a href="https://github.com/lorenwest">lorenwest</a></td><td><img src=https://avatars2.githubusercontent.com/u/25829?v=3><a href="https://github.com/markstos">markstos</a></td><td><img src=https://avatars0.githubusercontent.com/u/447151?v=3><a href="https://github.com/elliotttf">elliotttf</a></td><td><img src=https://avatars3.githubusercontent.com/u/66902?v=3><a href="https://github.com/leachiM2k">leachiM2k</a></td><td><img src=https://avatars2.githubusercontent.com/u/791137?v=3><a href="https://github.com/josx">josx</a></td><td><img src=https://avatars1.githubusercontent.com/u/133277?v=3><a href="https://github.com/enyo">enyo</a></td></tr><tr><td><img src=https://avatars0.githubusercontent.com/u/1077378?v=3><a href="https://github.com/arthanzel">arthanzel</a></td><td><img src=https://avatars1.githubusercontent.com/u/1656140?v=3><a href="https://github.com/eheikes">eheikes</a></td><td><img src=https://avatars3.githubusercontent.com/u/355800?v=3><a href="https://github.com/diversario">diversario</a></td><td><img src=https://avatars0.githubusercontent.com/u/138707?v=3><a href="https://github.com/th507">th507</a></td><td><img src=https://avatars1.githubusercontent.com/u/506460?v=3><a href="https://github.com/Osterjour">Osterjour</a></td><td><img src=https://avatars3.githubusercontent.com/u/842998?v=3><a href="https://github.com/nsabovic">nsabovic</a></td></tr><tr><td><img src=https://avatars3.githubusercontent.com/u/5138570?v=3><a href="https://github.com/ScionOfBytes">ScionOfBytes</a></td><td><img src=https://avatars1.githubusercontent.com/u/2529835?v=3><a href="https://github.com/simon-scherzinger">simon-scherzinger</a></td><td><img src=https://avatars2.githubusercontent.com/u/175627?v=3><a href="https://github.com/axelhzf">axelhzf</a></td><td><img src=https://avatars0.githubusercontent.com/u/7782055?v=3><a href="https://github.com/benkroeger">benkroeger</a></td><td><img src=https://avatars0.githubusercontent.com/u/1443067?v=3><a href="https://github.com/IvanVergiliev">IvanVergiliev</a></td><td><img src=https://avatars1.githubusercontent.com/u/1246875?v=3><a href="https://github.com/jaylynch">jaylynch</a></td></tr><tr><td><img src=https://avatars2.githubusercontent.com/u/145742?v=3><a href="https://github.com/jberrisch">jberrisch</a></td><td><img src=https://avatars0.githubusercontent.com/u/1918551?v=3><a href="https://github.com/nitzan-shaked">nitzan-shaked</a></td><td><img src=https://avatars0.githubusercontent.com/u/3058150?v=3><a href="https://github.com/robertrossmann">robertrossmann</a></td><td><img src=https://avatars1.githubusercontent.com/u/498929?v=3><a href="https://github.com/roncli">roncli</a></td><td><img src=https://avatars1.githubusercontent.com/u/1355559?v=3><a href="https://github.com/superoven">superoven</a></td><td><img src=https://avatars1.githubusercontent.com/u/54934?v=3><a href="https://github.com/wmertens">wmertens</a></td></tr><tr><td><img src=https://avatars0.githubusercontent.com/u/2842176?v=3><a href="https://github.com/XadillaX">XadillaX</a></td><td><img src=https://avatars2.githubusercontent.com/u/4425455?v=3><a href="https://github.com/ncuillery">ncuillery</a></td><td><img src=https://avatars2.githubusercontent.com/u/618330?v=3><a href="https://github.com/adityabansod">adityabansod</a></td><td><img src=https://avatars0.githubusercontent.com/u/270632?v=3><a href="https://github.com/thetalecrafter">thetalecrafter</a></td><td><img src=https://avatars3.githubusercontent.com/u/16861?v=3><a href="https://github.com/abh">abh</a></td><td><img src=https://avatars1.githubusercontent.com/u/57770?v=3><a href="https://github.com/bertrandom">bertrandom</a></td></tr></table>
127
+ <table id="contributors"><tr><td><img src=https://avatars2.githubusercontent.com/u/373538?v=4><a href="https://github.com/lorenwest">lorenwest</a></td><td><img src=https://avatars1.githubusercontent.com/u/25829?v=4><a href="https://github.com/markstos">markstos</a></td><td><img src=https://avatars3.githubusercontent.com/u/447151?v=4><a href="https://github.com/elliotttf">elliotttf</a></td><td><img src=https://avatars0.githubusercontent.com/u/66902?v=4><a href="https://github.com/leachiM2k">leachiM2k</a></td><td><img src=https://avatars1.githubusercontent.com/u/8839447?v=4><a href="https://github.com/jfelege">jfelege</a></td><td><img src=https://avatars1.githubusercontent.com/u/791137?v=4><a href="https://github.com/josx">josx</a></td></tr><tr><td><img src=https://avatars2.githubusercontent.com/u/133277?v=4><a href="https://github.com/enyo">enyo</a></td><td><img src=https://avatars3.githubusercontent.com/u/1077378?v=4><a href="https://github.com/arthanzel">arthanzel</a></td><td><img src=https://avatars2.githubusercontent.com/u/1656140?v=4><a href="https://github.com/eheikes">eheikes</a></td><td><img src=https://avatars0.githubusercontent.com/u/355800?v=4><a href="https://github.com/diversario">diversario</a></td><td><img src=https://avatars3.githubusercontent.com/u/138707?v=4><a href="https://github.com/th507">th507</a></td><td><img src=https://avatars2.githubusercontent.com/u/506460?v=4><a href="https://github.com/Osterjour">Osterjour</a></td></tr><tr><td><img src=https://avatars0.githubusercontent.com/u/842998?v=4><a href="https://github.com/nsabovic">nsabovic</a></td><td><img src=https://avatars0.githubusercontent.com/u/5138570?v=4><a href="https://github.com/ScionOfBytes">ScionOfBytes</a></td><td><img src=https://avatars2.githubusercontent.com/u/2529835?v=4><a href="https://github.com/simon-scherzinger">simon-scherzinger</a></td><td><img src=https://avatars1.githubusercontent.com/u/175627?v=4><a href="https://github.com/axelhzf">axelhzf</a></td><td><img src=https://avatars3.githubusercontent.com/u/7782055?v=4><a href="https://github.com/benkroeger">benkroeger</a></td><td><img src=https://avatars3.githubusercontent.com/u/1443067?v=4><a href="https://github.com/IvanVergiliev">IvanVergiliev</a></td></tr><tr><td><img src=https://avatars2.githubusercontent.com/u/1246875?v=4><a href="https://github.com/jaylynch">jaylynch</a></td><td><img src=https://avatars1.githubusercontent.com/u/145742?v=4><a href="https://github.com/jberrisch">jberrisch</a></td><td><img src=https://avatars1.githubusercontent.com/u/9355665?v=4><a href="https://github.com/kgoerlitz">kgoerlitz</a></td><td><img src=https://avatars3.githubusercontent.com/u/1918551?v=4><a href="https://github.com/nitzan-shaked">nitzan-shaked</a></td><td><img src=https://avatars3.githubusercontent.com/u/3058150?v=4><a href="https://github.com/robertrossmann">robertrossmann</a></td><td><img src=https://avatars2.githubusercontent.com/u/498929?v=4><a href="https://github.com/roncli">roncli</a></td></tr><tr><td><img src=https://avatars2.githubusercontent.com/u/1355559?v=4><a href="https://github.com/superoven">superoven</a></td><td><img src=https://avatars2.githubusercontent.com/u/54934?v=4><a href="https://github.com/wmertens">wmertens</a></td><td><img src=https://avatars3.githubusercontent.com/u/2842176?v=4><a href="https://github.com/XadillaX">XadillaX</a></td><td><img src=https://avatars1.githubusercontent.com/u/4425455?v=4><a href="https://github.com/ncuillery">ncuillery</a></td><td><img src=https://avatars1.githubusercontent.com/u/618330?v=4><a href="https://github.com/adityabansod">adityabansod</a></td><td><img src=https://avatars3.githubusercontent.com/u/270632?v=4><a href="https://github.com/thetalecrafter">thetalecrafter</a></td></tr></table>
128
128
 
129
129
  License
130
130
  -------
package/lib/config.js CHANGED
@@ -538,7 +538,7 @@ util.makeImmutable = function(object, property, value) {
538
538
  for (var i = 0; i < properties.length; i++) {
539
539
  var propertyName = properties[i],
540
540
  value = object[propertyName];
541
-
541
+
542
542
  if (!(value instanceof RawConfig)) {
543
543
  Object.defineProperty(object, propertyName, {
544
544
  value: value,
@@ -614,7 +614,8 @@ util.getConfigSources = function() {
614
614
  *
615
615
  * <p>
616
616
  * (deployment) is the deployment type, found in the $NODE_ENV environment
617
- * variable or --NODE_ENV command line parameter. Defaults to 'development'.
617
+ * variable (which can be overriden by using $NODE_CONFIG_ENV
618
+ * environment variable). Defaults to 'development'.
618
619
  * </p>
619
620
  *
620
621
  * <p>
@@ -641,10 +642,15 @@ util.loadFileConfigs = function(configDir) {
641
642
 
642
643
  // Initialize parameters from command line, environment, or default
643
644
  NODE_ENV = util.initParam('NODE_ENV', 'development');
645
+
646
+ // Override, NODE_ENV if NODE_CONFIG_ENV is specified.
647
+ NODE_ENV = util.initParam('NODE_CONFIG_ENV', NODE_ENV);
648
+
644
649
  CONFIG_DIR = configDir || util.initParam('NODE_CONFIG_DIR', Path.join( process.cwd(), 'config') );
645
650
  if (CONFIG_DIR.indexOf('.') === 0) {
646
651
  CONFIG_DIR = Path.join(process.cwd() , CONFIG_DIR);
647
652
  }
653
+
648
654
  APP_INSTANCE = util.initParam('NODE_APP_INSTANCE');
649
655
  HOST = util.initParam('HOST');
650
656
  HOSTNAME = util.initParam('HOSTNAME');
@@ -867,7 +873,7 @@ util.parseFile = function(fullFilename) {
867
873
  if (extension === 'js') {
868
874
  // Use the built-in parser for .js files
869
875
  configObject = require(fullFilename);
870
- }
876
+ }
871
877
  else if (extension === 'ts') {
872
878
  require('ts-node').register({
873
879
  lazy: true,
@@ -1670,6 +1676,16 @@ util.getRegExpFlags = function (re) {
1670
1676
  return flags;
1671
1677
  };
1672
1678
 
1679
+ /**
1680
+ * Returns a new deep copy of the current config object, or any part of the config if provided.
1681
+ *
1682
+ * @param {Object} config The part of the config to copy and serialize. Omit this argument to return the entire config.
1683
+ * @returns {Object} The cloned config or part of the config
1684
+ */
1685
+ util.toObject = function(config) {
1686
+ return JSON.parse(JSON.stringify(config || this));
1687
+ };
1688
+
1673
1689
  // Run strictness checks on NODE_ENV and NODE_APP_INSTANCE and throw an error if there's a problem.
1674
1690
  util.runStrictnessChecks = function (config) {
1675
1691
  var sources = config.util.getConfigSources();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "config",
3
- "version": "1.26.1",
3
+ "version": "1.28.1",
4
4
  "main": "./lib/config.js",
5
5
  "description": "Configuration control for production node deployments",
6
6
  "author": "Loren West <open_source@lorenwest.com>",
@@ -31,8 +31,8 @@
31
31
  "properties": "~1.2.1",
32
32
  "semver": "5.3.0",
33
33
  "toml": "^2.0.6",
34
- "ts-node": "^2.1.0",
35
- "typescript": "^2.2.1",
34
+ "ts-node": "^3.3.0",
35
+ "typescript": "^2.4.2",
36
36
  "underscore": "^1.8.3",
37
37
  "vows": ">=0.8.1",
38
38
  "x2js": "^2.0.1"
@@ -42,7 +42,7 @@
42
42
  "url": "http://github.com/lorenwest/node-config.git"
43
43
  },
44
44
  "engines": {
45
- "node": ">0.4.x"
45
+ "node": ">= 4.0.0"
46
46
  },
47
47
  "scripts": {
48
48
  "test": "./node_modules/vows/bin/vows test/*.js --spec"