Socket
Socket
Sign inDemoInstall

cnf

Package Overview
Dependencies
2
Maintainers
6
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.6 to 2.2.0

15

package.json
{
"name": "cnf",
"version": "2.1.6",
"version": "2.2.0",
"description": "Configuration loader",

@@ -9,11 +9,12 @@ "scripts": {

"devDependencies": {
"mocha": "~2.1.0",
"chai": "~1.10.0",
"sinon": "~1.12.2",
"sinon-chai": "~2.6.0",
"mocha-jshint": "~0.0.9"
"chai": "^2.2.0",
"mocha": "^2.2.1",
"mocha-jshint": "^1.0.0",
"sinon": "^1.14.1",
"sinon-chai": "^2.7.0"
},
"main": "./source/config.js",
"dependencies": {
"resolve": "~0.5.0"
"deep-extend": "^0.3.3",
"resolve": "^0.5.0"
},

@@ -20,0 +21,0 @@ "directories": {

@@ -1,2 +0,2 @@

cnf [![Build Status](https://travis-ci.org/e-conomic/config.svg?branch=master)](https://travis-ci.org/e-conomic/config)
cnf [![npm version](https://badge.fury.io/js/cnf.svg)](http://badge.fury.io/js/cnf) [![Build Status](https://travis-ci.org/e-conomic/config.svg?branch=master)](https://travis-ci.org/e-conomic/config) [![Dependency Status](https://david-dm.org/e-conomic/config.svg)](https://david-dm.org/e-conomic/config) [![devDependency Status](https://david-dm.org/e-conomic/config/dev-status.svg)](https://david-dm.org/e-conomic/config#info=devDependencies)
===

@@ -13,6 +13,6 @@

console.log('port: '+config.http.port);
console.log('port: ' + config.http.port);
```
It will look for a configuration file called `$APP_ENV.app.config.js` in the current working directory.
It will look for a configuration file called `$APP_ENV.app.config.js` in the current working directory and will be extended with config from `global.app.config.js`.

@@ -36,2 +36,3 @@ To override configs use a command line argument prefixed with `app.`

--app.mySetting "$regexp(/myRegExp/gmi)"
```

@@ -5,4 +5,5 @@ var fs = require('fs');

var env = process.env.APP_ENV || process.env.NODE_ENV || 'development';
var deepExtend = require('deep-extend');
var envPath = resolve.sync(env+'.app.config.js', {
var envPath = resolve.sync(env + '.app.config.js', {
basedir: process.cwd(),

@@ -12,8 +13,13 @@ moduleDirectory: 'config'

if (!fs.existsSync(envPath)) {
throw new Error(env+' configuration could not be found');
}
var envFile = require(envPath);
try {
var globalConfigPath = resolve.sync('global.app.config.js', {
basedir: process.cwd(),
moduleDirectory: 'config'
});
var globalConfig = require(globalConfigPath);
envFile = deepExtend(globalConfig, envFile);
} catch(e) {}
var replaceConfigs = function(visit) {

@@ -20,0 +26,0 @@ var next = function(prevKeys, obj) {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc