Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

settings-lib

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

settings-lib - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

6

history.md

@@ -1,3 +0,7 @@

# v0.2.0 / 2016-04-15
# v0.2.1 / 2016-04-19
* Fixed issue where environment config override file search was not properly working
# v0.2.0 / 2016-04-18
* Introduced native `Promise` support

@@ -4,0 +8,0 @@ * Moved to gulp for build tasks running

37

lib/settings.js

@@ -345,8 +345,6 @@ var

return new Promise((resolve, reject) => {
let
environmentOverridePath,
searchEnvironment =
process.env.NODE_ENV &&
settings.options.environmentSearchPaths &&
Array.isArray(settings.options.environmentSearchPaths);
let searchEnvironment =
process.env.NODE_ENV &&
settings.options.environmentSearchPaths &&
Array.isArray(settings.options.environmentSearchPaths);

@@ -357,18 +355,28 @@ if (!searchEnvironment) {

return Promise.race(
return Promise.all(
settings.options.environmentSearchPaths
.reverse() // reversing paths so that the first found match is used
.map((searchPath) => {
environmentOverridePath = path.resolve([
let environmentOverridePath = path.resolve([
path.join(searchPath, process.env.NODE_ENV),
'.json'].join(''));
return checkIfFileExists(environmentOverridePath);
return new Promise((resolve, reject) => {
return checkIfFileExists(environmentOverridePath)
.then((exists) => {
return resolve({
path : environmentOverridePath,
exists : exists
});
})
.catch(reject);
});
})
).then((exists) => {
if (!exists) {
).then((resultsList) => {
let validPaths = resultsList.filter((result) => (result.exists));
if (!validPaths.length) {
return resolve();
}
return getConfigFileContents(environmentOverridePath)
return getConfigFileContents(validPaths[0].path)
.then((contents) => {

@@ -380,3 +388,4 @@ settings.environmentConfig = contents;

.catch(reject);
});
})
.catch(reject);
});

@@ -383,0 +392,0 @@ }

@@ -5,3 +5,3 @@ {

"main": "./lib/settings.js",
"version": "0.2.0",
"version": "0.2.1",
"author": "Joshua Thomas (http://github.com/brozeph)",

@@ -8,0 +8,0 @@ "license": "MIT",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc