Comparing version 3.2.0 to 3.3.0
{ | ||
"name": "cnf", | ||
"version": "3.2.0", | ||
"version": "3.3.0", | ||
"description": "Configuration loader", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -8,2 +8,12 @@ var fs = require('fs'); | ||
function exportDefaultSupport(envPath) { | ||
var envFile = require(envPath); | ||
var keys = Object.keys(envFile); | ||
if (keys.length === 1 && keys[0] === 'default') { | ||
console.log(keys); | ||
envFile = envFile.default; | ||
} | ||
return envFile; | ||
} | ||
try { | ||
@@ -14,3 +24,3 @@ envPath = resolve.sync(env + '.app.config.js', { | ||
}); | ||
envFile = require(envPath); | ||
envFile = exportDefaultSupport(envPath); | ||
} catch (ex) { | ||
@@ -21,3 +31,3 @@ envPath = resolve.sync(env + '.js', { | ||
}); | ||
envFile = require(envPath); | ||
envFile = exportDefaultSupport(envPath); | ||
} | ||
@@ -30,3 +40,3 @@ | ||
}); | ||
globalConfig = require(globalConfigPath); | ||
globalConfig = exportDefaultSupport(globalConfigPath); | ||
envFile = deepExtend(globalConfig, envFile); | ||
@@ -41,7 +51,6 @@ } catch (e) { | ||
}); | ||
globalConfig = require(globalConfigPath); | ||
globalConfig = exportDefaultSupport(globalConfigPath); | ||
envFile = deepExtend(globalConfig, envFile); | ||
} catch (e) { | ||
} | ||
} | ||
@@ -125,8 +134,3 @@ | ||
var keys = Object.keys(envFile); | ||
if(keys.length === 1 && keys[0] === 'default'){ | ||
envFile = envFile.default; | ||
} | ||
module.exports = envFile; | ||
module.exports.env = env; |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
5157
116
4