config 3.2.2 → 3.2.6
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 +20 -0
- package/LICENSE +1 -1
- package/README.md +11 -11
- package/lib/config.js +15 -4
- package/package.json +1 -1
package/History.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
3.2.6 / 2020-02-21
|
|
2
|
+
==================
|
|
3
|
+
|
|
4
|
+
* Updated copyright date ranges
|
|
5
|
+
|
|
6
|
+
3.2.5 / 2020-01-16
|
|
7
|
+
==================
|
|
8
|
+
|
|
9
|
+
* Fixed issue with getCustomEnvVars and multiple config dirs #585 - @dekelev
|
|
10
|
+
|
|
11
|
+
3.2.4 / 2019-10-25
|
|
12
|
+
==================
|
|
13
|
+
|
|
14
|
+
* Improved error handling of env variables value parse - @leonardovillela
|
|
15
|
+
|
|
16
|
+
3.2.3 / 2019-10-03
|
|
17
|
+
==================
|
|
18
|
+
|
|
19
|
+
* Fixed strict mode warning #460 - @fedulovivan
|
|
20
|
+
|
|
1
21
|
3.2.2 / 2019-07-20
|
|
2
22
|
==================
|
|
3
23
|
|
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright 2010-
|
|
1
|
+
// Copyright 2010-2020, Loren West and other contributors
|
|
2
2
|
|
|
3
3
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
4
|
// of this software and associated documentation files (the "Software"), to
|
package/README.md
CHANGED
|
@@ -126,7 +126,7 @@ Articles
|
|
|
126
126
|
|
|
127
127
|
Further Information
|
|
128
128
|
---------------------
|
|
129
|
-
If you still don't see what you are looking for, here more resources to check:
|
|
129
|
+
If you still don't see what you are looking for, here are some more resources to check:
|
|
130
130
|
|
|
131
131
|
* The [wiki may have more pages](https://github.com/lorenwest/node-config/wiki) which are not directly linked from here.
|
|
132
132
|
* Review [questions tagged with node-config](https://stackexchange.com/filters/207096/node-config) on StackExchange. These are monitored by `node-config` contributors.
|
|
@@ -136,34 +136,34 @@ Contributors
|
|
|
136
136
|
------------
|
|
137
137
|
<table id="contributors"><tr><td><img src=https://avatars2.githubusercontent.com/u/373538?v=4><a href="https://github.com/lorenwest">lorenwest</a></td>
|
|
138
138
|
<td><img src=https://avatars1.githubusercontent.com/u/25829?v=4><a href="https://github.com/markstos">markstos</a></td>
|
|
139
|
+
<td><img src=https://avatars1.githubusercontent.com/u/1083065?v=4><a href="https://github.com/iMoses">iMoses</a></td>
|
|
139
140
|
<td><img src=https://avatars3.githubusercontent.com/u/447151?v=4><a href="https://github.com/elliotttf">elliotttf</a></td>
|
|
140
141
|
<td><img src=https://avatars1.githubusercontent.com/u/8839447?v=4><a href="https://github.com/jfelege">jfelege</a></td>
|
|
141
142
|
<td><img src=https://avatars0.githubusercontent.com/u/66902?v=4><a href="https://github.com/leachiM2k">leachiM2k</a></td>
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
</tr><tr><td><img src=https://avatars1.githubusercontent.com/u/791137?v=4><a href="https://github.com/josx">josx</a></td>
|
|
144
|
+
<td><img src=https://avatars2.githubusercontent.com/u/133277?v=4><a href="https://github.com/enyo">enyo</a></td>
|
|
144
145
|
<td><img src=https://avatars1.githubusercontent.com/u/4307697?v=4><a href="https://github.com/leosuncin">leosuncin</a></td>
|
|
145
146
|
<td><img src=https://avatars3.githubusercontent.com/u/1077378?v=4><a href="https://github.com/arthanzel">arthanzel</a></td>
|
|
146
147
|
<td><img src=https://avatars2.githubusercontent.com/u/1656140?v=4><a href="https://github.com/eheikes">eheikes</a></td>
|
|
147
148
|
<td><img src=https://avatars3.githubusercontent.com/u/138707?v=4><a href="https://github.com/th507">th507</a></td>
|
|
148
|
-
|
|
149
|
-
|
|
149
|
+
</tr><tr><td><img src=https://avatars2.githubusercontent.com/u/506460?v=4><a href="https://github.com/Osterjour">Osterjour</a></td>
|
|
150
|
+
<td><img src=https://avatars0.githubusercontent.com/u/842998?v=4><a href="https://github.com/nsabovic">nsabovic</a></td>
|
|
150
151
|
<td><img src=https://avatars0.githubusercontent.com/u/5138570?v=4><a href="https://github.com/BadgerBadgerBadgerBadger">BadgerBadgerBadgerBadger</a></td>
|
|
151
152
|
<td><img src=https://avatars2.githubusercontent.com/u/2529835?v=4><a href="https://github.com/simon-scherzinger">simon-scherzinger</a></td>
|
|
153
|
+
<td><img src=https://avatars3.githubusercontent.com/u/8650543?v=4><a href="https://github.com/leonardovillela">leonardovillela</a></td>
|
|
152
154
|
<td><img src=https://avatars1.githubusercontent.com/u/175627?v=4><a href="https://github.com/axelhzf">axelhzf</a></td>
|
|
153
|
-
|
|
155
|
+
</tr><tr><td><img src=https://avatars3.githubusercontent.com/u/7782055?v=4><a href="https://github.com/benkroeger">benkroeger</a></td>
|
|
154
156
|
<td><img src=https://avatars3.githubusercontent.com/u/1872824?v=4><a href="https://github.com/fgheorghe">fgheorghe</a></td>
|
|
155
|
-
|
|
157
|
+
<td><img src=https://avatars3.githubusercontent.com/u/1443067?v=4><a href="https://github.com/IvanVergiliev">IvanVergiliev</a></td>
|
|
156
158
|
<td><img src=https://avatars0.githubusercontent.com/u/1736957?v=4><a href="https://github.com/jpwilliams">jpwilliams</a></td>
|
|
157
159
|
<td><img src=https://avatars2.githubusercontent.com/u/1246875?v=4><a href="https://github.com/jaylynch">jaylynch</a></td>
|
|
158
160
|
<td><img src=https://avatars1.githubusercontent.com/u/145742?v=4><a href="https://github.com/jberrisch">jberrisch</a></td>
|
|
159
|
-
|
|
161
|
+
</tr><tr><td><img src=https://avatars1.githubusercontent.com/u/9355665?v=4><a href="https://github.com/kgoerlitz">kgoerlitz</a></td>
|
|
160
162
|
<td><img src=https://avatars0.githubusercontent.com/u/8525267?v=4><a href="https://github.com/bertho-zero">bertho-zero</a></td>
|
|
161
|
-
</tr><tr><td><img src=https://avatars3.githubusercontent.com/u/8650543?v=4><a href="https://github.com/leonardovillela">leonardovillela</a></td>
|
|
162
163
|
<td><img src=https://avatars3.githubusercontent.com/u/1918551?v=4><a href="https://github.com/nitzan-shaked">nitzan-shaked</a></td>
|
|
163
164
|
<td><img src=https://avatars3.githubusercontent.com/u/3058150?v=4><a href="https://github.com/robertrossmann">robertrossmann</a></td>
|
|
164
165
|
<td><img src=https://avatars2.githubusercontent.com/u/498929?v=4><a href="https://github.com/roncli">roncli</a></td>
|
|
165
166
|
<td><img src=https://avatars2.githubusercontent.com/u/1355559?v=4><a href="https://github.com/superoven">superoven</a></td>
|
|
166
|
-
<td><img src=https://avatars2.githubusercontent.com/u/54934?v=4><a href="https://github.com/wmertens">wmertens</a></td>
|
|
167
167
|
</tr></table>
|
|
168
168
|
|
|
169
169
|
License
|
|
@@ -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-
|
|
174
|
+
Copyright (c) 2010-2020 Loren West
|
|
175
175
|
[and other contributors](https://github.com/lorenwest/node-config/graphs/contributors)
|
|
176
176
|
|
package/lib/config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// config.js (c) 2010-
|
|
1
|
+
// config.js (c) 2010-2020 Loren West and other contributors
|
|
2
2
|
// May be freely distributed under the MIT license.
|
|
3
3
|
// For further details and documentation:
|
|
4
4
|
// http://lorenwest.github.com/node-config
|
|
@@ -768,7 +768,8 @@ util.parseFile = function(fullFilename) {
|
|
|
768
768
|
}
|
|
769
769
|
catch (e2) {
|
|
770
770
|
if (e2.code !== 'ENOENT') {
|
|
771
|
-
throw new Error('Config file ' + fullFilename + ' cannot be read'
|
|
771
|
+
throw new Error('Config file ' + fullFilename + ' cannot be read. Error code is: '+e2.code
|
|
772
|
+
+'. Error message is: '+e2.message);
|
|
772
773
|
}
|
|
773
774
|
return null; // file doesn't exists
|
|
774
775
|
}
|
|
@@ -1038,7 +1039,12 @@ util.substituteDeep = function (substitutionMap, variables) {
|
|
|
1038
1039
|
}
|
|
1039
1040
|
else if (util.isObject(value)) { // work on the subtree, giving it a clone of the pathTo
|
|
1040
1041
|
if('__name' in value && '__format' in value && vars[value.__name]) {
|
|
1041
|
-
|
|
1042
|
+
try {
|
|
1043
|
+
var parsedValue = util.parseString(vars[value.__name], value.__format);
|
|
1044
|
+
} catch(err) {
|
|
1045
|
+
err.message = '__format parser error in ' + value.__name + ': ' + err.message;
|
|
1046
|
+
throw err;
|
|
1047
|
+
}
|
|
1042
1048
|
util.setPath(result, pathTo.concat(prop), parsedValue);
|
|
1043
1049
|
} else {
|
|
1044
1050
|
_substituteVars(value, vars, pathTo.concat(prop));
|
|
@@ -1067,8 +1073,13 @@ util.substituteDeep = function (substitutionMap, variables) {
|
|
|
1067
1073
|
*/
|
|
1068
1074
|
util.getCustomEnvVars = function (CONFIG_DIR, extNames) {
|
|
1069
1075
|
var result = {};
|
|
1076
|
+
var resolutionIndex = 1;
|
|
1077
|
+
var allowedFiles = {};
|
|
1070
1078
|
extNames.forEach(function (extName) {
|
|
1071
|
-
|
|
1079
|
+
allowedFiles['custom-environment-variables' + '.' + extName] = resolutionIndex++;
|
|
1080
|
+
});
|
|
1081
|
+
var locatedFiles = util.locateMatchingFiles(CONFIG_DIR, allowedFiles);
|
|
1082
|
+
locatedFiles.forEach(function (fullFilename) {
|
|
1072
1083
|
var configObj = util.parseFile(fullFilename);
|
|
1073
1084
|
if (configObj) {
|
|
1074
1085
|
var environmentSubstitutions = util.substituteDeep(configObj, process.env);
|