Comparing version 3.3.3 to 3.3.4
@@ -46,3 +46,3 @@ var asyncSymbol = Symbol('asyncSymbol'); | ||
for (var property in prop) { | ||
if (prop.hasOwnProperty(property) && prop[property] != null) { | ||
if (Object.hasOwnProperty.call(prop, property) && prop[property] != null) { | ||
propsToSort.push(property); | ||
@@ -49,0 +49,0 @@ } |
@@ -0,1 +1,6 @@ | ||
3.3.4 / 2021-02-26 | ||
================== | ||
* FIX #517 0 loadFileConfigs incorrectly adds to getConfigSources @NguyenMatthieu | ||
3.3.3 / 2020-11-26 | ||
@@ -2,0 +7,0 @@ ================== |
@@ -451,2 +451,25 @@ // config.js (c) 2010-2020 Loren West and other contributors | ||
/** | ||
* Looks into an options object for a specific attribute | ||
* | ||
* <p> | ||
* This method looks into the options object, and if an attribute is defined, returns it, | ||
* and if not, returns the default value | ||
* </p> | ||
* | ||
* @method getOption | ||
* @param options {Object | undefined} the options object | ||
* @param optionName {string} the attribute name to look for | ||
* @param defaultValue { any } the default in case the options object is empty, or the attribute does not exist. | ||
* @return options[optionName] if defined, defaultValue if not. | ||
*/ | ||
util.getOption = function(options, optionName, defaultValue) { | ||
if (options !== undefined && options[optionName] !== undefined){ | ||
return options[optionName]; | ||
} else { | ||
return defaultValue; | ||
} | ||
}; | ||
/** | ||
* Load the individual file configurations. | ||
@@ -491,3 +514,3 @@ * | ||
* (deployment) is the deployment type, found in the $NODE_ENV environment | ||
* variable (which can be overriden by using $NODE_CONFIG_ENV | ||
* variable (which can be overridden by using $NODE_CONFIG_ENV | ||
* environment variable). Defaults to 'development'. | ||
@@ -504,3 +527,3 @@ * </p> | ||
* command line parameter) is set, then files with this appendage will be loaded. | ||
* See the Multiple Application Instances section of the main documentaion page | ||
* See the Multiple Application Instances section of the main documentation page | ||
* for more information. | ||
@@ -511,5 +534,7 @@ * </p> | ||
* @method loadFileConfigs | ||
* @param configDir { string | null } the path to the directory containing the configurations to load | ||
* @param options { object | undefined } parsing options. Current supported option: skipConfigSources: true|false | ||
* @return config {Object} The configuration object | ||
*/ | ||
util.loadFileConfigs = function(configDir) { | ||
util.loadFileConfigs = function(configDir, options) { | ||
@@ -623,3 +648,3 @@ // Initialize | ||
locatedFiles.forEach(function(fullFilename) { | ||
var configObj = util.parseFile(fullFilename); | ||
var configObj = util.parseFile(fullFilename, options); | ||
if (configObj) { | ||
@@ -641,6 +666,9 @@ util.extendDeep(config, configObj); | ||
util.extendDeep(config, envConfig); | ||
configSources.push({ | ||
name: "$NODE_CONFIG", | ||
parsed: envConfig, | ||
}); | ||
var skipConfigSources = util.getOption(options,'skipConfigSources', false); | ||
if (!skipConfigSources){ | ||
configSources.push({ | ||
name: "$NODE_CONFIG", | ||
parsed: envConfig, | ||
}); | ||
} | ||
} | ||
@@ -657,6 +685,9 @@ | ||
util.extendDeep(config, cmdLineConfig); | ||
configSources.push({ | ||
name: "--NODE_CONFIG argument", | ||
parsed: cmdLineConfig, | ||
}); | ||
var skipConfigSources = util.getOption(options,'skipConfigSources', false); | ||
if (!skipConfigSources){ | ||
configSources.push({ | ||
name: "--NODE_CONFIG argument", | ||
parsed: cmdLineConfig, | ||
}); | ||
} | ||
} | ||
@@ -723,3 +754,3 @@ | ||
for (var property in prop) { | ||
if (prop.hasOwnProperty(property) && prop[property] != null) { | ||
if (Object.hasOwnProperty.call(prop, property) && prop[property] != null) { | ||
propsToSort.push(property); | ||
@@ -779,5 +810,6 @@ } | ||
* @param fullFilename {string} The full file path and name | ||
* @param options { object | undefined } parsing options. Current supported option: skipConfigSources: true|false | ||
* @return configObject {object|null} The configuration object parsed from the file | ||
*/ | ||
util.parseFile = function(fullFilename) { | ||
util.parseFile = function(fullFilename, options) { | ||
var t = this, // Initialize | ||
@@ -824,4 +856,5 @@ configObject = null, | ||
// Keep track of this configuration sources, including empty ones | ||
if (typeof configObject === 'object') { | ||
// Keep track of this configuration sources, including empty ones, unless the skipConfigSources flag is set to true in the options | ||
var skipConfigSources = util.getOption(options,'skipConfigSources', false); | ||
if (typeof configObject === 'object' && !skipConfigSources) { | ||
configSources.push({ | ||
@@ -838,3 +871,3 @@ name: fullFilename, | ||
/** | ||
* Parse and return the specied string with the specified format. | ||
* Parse and return the specified string with the specified format. | ||
* | ||
@@ -1037,3 +1070,3 @@ * The format determines the parser to use. | ||
nextKey = path.shift(); | ||
if (!object.hasOwnProperty(nextKey)) { | ||
if (!Object.hasOwnProperty.call(object, nextKey)) { | ||
object[nextKey] = {}; | ||
@@ -1053,5 +1086,5 @@ } | ||
* @method substituteDeep | ||
* @param substitionMap {object} - an object whose terminal (non-subobject) values are strings | ||
* @param substitutionMap {object} - an object whose terminal (non-subobject) values are strings | ||
* @param variables {object[string:value]} - usually process.env, a flat object used to transform | ||
* terminal values in a copy of substititionMap. | ||
* terminal values in a copy of substitutionMap. | ||
* @returns {object} - deep copy of substitutionMap with only those paths whose terminal values | ||
@@ -1101,3 +1134,3 @@ * corresponded to a key in `variables` | ||
* @method getCustomEnvVars | ||
* @param CONFIG_DIR {string} - the passsed configuration directory | ||
* @param CONFIG_DIR {string} - the passed configuration directory | ||
* @param extNames {Array[string]} - acceptable configuration file extension names. | ||
@@ -1274,3 +1307,3 @@ * @returns {object} - mapped environment variables or {} if there are none | ||
if (fromIsDeferredFunc && mergeInto.hasOwnProperty(prop)) { | ||
if (fromIsDeferredFunc && Object.hasOwnProperty.call(mergeInto, prop)) { | ||
mergeFrom[prop]._original = isDeferredFunc ? mergeInto[prop]._original : mergeInto[prop]; | ||
@@ -1450,3 +1483,3 @@ } | ||
// Throw an exception if there's no explict config file for NODE_APP_INSTANCE | ||
// Throw an exception if there's no explicit config file for NODE_APP_INSTANCE | ||
var anyFilesMatchInstance = sourceFilenames.some(function (filename) { | ||
@@ -1453,0 +1486,0 @@ return filename.match(APP_INSTANCE); |
{ | ||
"name": "config", | ||
"version": "3.3.3", | ||
"version": "3.3.4", | ||
"main": "./lib/config.js", | ||
@@ -44,3 +44,3 @@ "description": "Configuration control for production node deployments", | ||
"engines": { | ||
"node": ">= 6.0.0" | ||
"node": ">= 10.0.0" | ||
}, | ||
@@ -47,0 +47,0 @@ "scripts": { |
/** | ||
* This is meant to wrap configuration objects that should be left as is, | ||
* meaning that the object or its protoype will not be modified in any way | ||
* meaning that the object or its prototype will not be modified in any way | ||
*/ | ||
@@ -5,0 +5,0 @@ function RawConfig () { |
@@ -137,32 +137,32 @@ Configure your Node.js Applications | ||
------------ | ||
<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://avatars1.githubusercontent.com/u/1083065?v=4><a href="https://github.com/iMoses">iMoses</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://avatars1.githubusercontent.com/u/8839447?v=4><a href="https://github.com/jfelege">jfelege</a></td> | ||
<td><img src=https://avatars0.githubusercontent.com/u/66902?v=4><a href="https://github.com/leachiM2k">leachiM2k</a></td> | ||
</tr><tr><td><img src=https://avatars1.githubusercontent.com/u/791137?v=4><a href="https://github.com/josx">josx</a></td> | ||
<td><img src=https://avatars2.githubusercontent.com/u/133277?v=4><a href="https://github.com/enyo">enyo</a></td> | ||
<td><img src=https://avatars1.githubusercontent.com/u/4307697?v=4><a href="https://github.com/leosuncin">leosuncin</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://avatars3.githubusercontent.com/u/138707?v=4><a href="https://github.com/th507">th507</a></td> | ||
</tr><tr><td><img src=https://avatars2.githubusercontent.com/u/506460?v=4><a href="https://github.com/Osterjour">Osterjour</a></td> | ||
<td><img src=https://avatars3.githubusercontent.com/u/1751645?v=4><a href="https://github.com/cunneen">cunneen</a></td> | ||
<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/BadgerBadgerBadgerBadger">BadgerBadgerBadgerBadger</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://avatars3.githubusercontent.com/u/8650543?v=4><a href="https://github.com/leonardovillela">leonardovillela</a></td> | ||
</tr><tr><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/1872824?v=4><a href="https://github.com/fgheorghe">fgheorghe</a></td> | ||
<td><img src=https://avatars3.githubusercontent.com/u/1443067?v=4><a href="https://github.com/IvanVergiliev">IvanVergiliev</a></td> | ||
<td><img src=https://avatars0.githubusercontent.com/u/1736957?v=4><a href="https://github.com/jpwilliams">jpwilliams</a></td> | ||
<td><img src=https://avatars2.githubusercontent.com/u/1246875?v=4><a href="https://github.com/jaylynch">jaylynch</a></td> | ||
</tr><tr><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://avatars0.githubusercontent.com/u/8525267?v=4><a href="https://github.com/bertho-zero">bertho-zero</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> | ||
<table id="contributors"><tr><td><img src=https://avatars.githubusercontent.com/u/373538?v=4><a href="https://github.com/lorenwest">lorenwest</a></td> | ||
<td><img src=https://avatars.githubusercontent.com/u/25829?v=4><a href="https://github.com/markstos">markstos</a></td> | ||
<td><img src=https://avatars.githubusercontent.com/u/1083065?v=4><a href="https://github.com/iMoses">iMoses</a></td> | ||
<td><img src=https://avatars.githubusercontent.com/u/447151?v=4><a href="https://github.com/elliotttf">elliotttf</a></td> | ||
<td><img src=https://avatars.githubusercontent.com/u/8839447?v=4><a href="https://github.com/jfelege">jfelege</a></td> | ||
<td><img src=https://avatars.githubusercontent.com/u/66902?v=4><a href="https://github.com/leachiM2k">leachiM2k</a></td> | ||
</tr><tr><td><img src=https://avatars.githubusercontent.com/u/791137?v=4><a href="https://github.com/josx">josx</a></td> | ||
<td><img src=https://avatars.githubusercontent.com/u/133277?v=4><a href="https://github.com/enyo">enyo</a></td> | ||
<td><img src=https://avatars.githubusercontent.com/u/4307697?v=4><a href="https://github.com/leosuncin">leosuncin</a></td> | ||
<td><img src=https://avatars.githubusercontent.com/u/1077378?v=4><a href="https://github.com/arthanzel">arthanzel</a></td> | ||
<td><img src=https://avatars.githubusercontent.com/u/1656140?v=4><a href="https://github.com/eheikes">eheikes</a></td> | ||
<td><img src=https://avatars.githubusercontent.com/u/138707?v=4><a href="https://github.com/th507">th507</a></td> | ||
</tr><tr><td><img src=https://avatars.githubusercontent.com/u/506460?v=4><a href="https://github.com/Osterjour">Osterjour</a></td> | ||
<td><img src=https://avatars.githubusercontent.com/u/1751645?v=4><a href="https://github.com/cunneen">cunneen</a></td> | ||
<td><img src=https://avatars.githubusercontent.com/u/842998?v=4><a href="https://github.com/nsabovic">nsabovic</a></td> | ||
<td><img src=https://avatars.githubusercontent.com/u/5138570?v=4><a href="https://github.com/BadgerBadgerBadgerBadger">BadgerBadgerBadgerBadger</a></td> | ||
<td><img src=https://avatars.githubusercontent.com/u/2529835?v=4><a href="https://github.com/simon-scherzinger">simon-scherzinger</a></td> | ||
<td><img src=https://avatars.githubusercontent.com/u/8650543?v=4><a href="https://github.com/leonardovillela">leonardovillela</a></td> | ||
</tr><tr><td><img src=https://avatars.githubusercontent.com/u/175627?v=4><a href="https://github.com/axelhzf">axelhzf</a></td> | ||
<td><img src=https://avatars.githubusercontent.com/u/7782055?v=4><a href="https://github.com/benkroeger">benkroeger</a></td> | ||
<td><img src=https://avatars.githubusercontent.com/u/1872824?v=4><a href="https://github.com/fgheorghe">fgheorghe</a></td> | ||
<td><img src=https://avatars.githubusercontent.com/u/1443067?v=4><a href="https://github.com/IvanVergiliev">IvanVergiliev</a></td> | ||
<td><img src=https://avatars.githubusercontent.com/u/1736957?v=4><a href="https://github.com/jpwilliams">jpwilliams</a></td> | ||
<td><img src=https://avatars.githubusercontent.com/u/1246875?v=4><a href="https://github.com/jaylynch">jaylynch</a></td> | ||
</tr><tr><td><img src=https://avatars.githubusercontent.com/u/145742?v=4><a href="https://github.com/jberrisch">jberrisch</a></td> | ||
<td><img src=https://avatars.githubusercontent.com/u/9355665?v=4><a href="https://github.com/kgoerlitz">kgoerlitz</a></td> | ||
<td><img src=https://avatars.githubusercontent.com/u/8525267?v=4><a href="https://github.com/bertho-zero">bertho-zero</a></td> | ||
<td><img src=https://avatars.githubusercontent.com/u/6686044?v=4><a href="https://github.com/NguyenMatthieu">NguyenMatthieu</a></td> | ||
<td><img src=https://avatars.githubusercontent.com/u/1918551?v=4><a href="https://github.com/nitzan-shaked">nitzan-shaked</a></td> | ||
<td><img src=https://avatars.githubusercontent.com/u/3058150?v=4><a href="https://github.com/robertrossmann">robertrossmann</a></td> | ||
</tr></table> | ||
@@ -169,0 +169,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
91996
1774