Comparing version 0.0.1 to 0.0.2
@@ -1,6 +0,6 @@ | ||
var env, | ||
, nconf = require('nconf'); | ||
var nconf = require('nconf') | ||
, path = require('path'); | ||
nconf.argv().env().file({ | ||
file: 'config/env.json' | ||
file: path.join('conf', 'env.json') | ||
}); | ||
@@ -10,15 +10,16 @@ | ||
if (overridingConfig != null) { | ||
nconf.file(overridingConfig); | ||
console.log('Found a config file to override anything in config/default.json'); | ||
if (overridingConfig !== undefined) { | ||
nconf.file(overridingConfig); | ||
console.log('Found a config file to override anything in conf/env.json'); | ||
} | ||
env = process.env.NODE_ENV || 'development'; | ||
envConf = nconf.get(env); | ||
var env = process.env.NODE_ENV || 'development', | ||
envConf = nconf.get(env); | ||
for (k in envConf) { | ||
v = envConf[k]; | ||
exports[k] = v; | ||
for (var key in envConf) { | ||
if (envConf.hasOwnProperty(key)) { | ||
exports[key] = envConf[key]; | ||
} | ||
} | ||
exports.config = env; |
{ | ||
"name": "envi", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "an nconf wrapper around conf/env.js & env.json", | ||
@@ -11,2 +11,3 @@ "main": "bin/envi.js", | ||
}, | ||
"keywords": ["environment", "config", "nconf", "json"], | ||
"license": "BSD", | ||
@@ -13,0 +14,0 @@ "dependencies": { |
@@ -9,5 +9,5 @@ ## Installation | ||
``` | ||
envi | ||
Done. Now run 'npm install nconf -save' | ||
☁ bin [master] ⚡ envi | ||
Created your conf directory with env.js and env.json! | ||
Install latest version of nconf? y or n [y] | ||
``` | ||
@@ -17,3 +17,3 @@ | ||
You need configuration vars that are enviromentally specific. You also want them to use nconf goodness (https://github.com/flatiron/nconf). | ||
You need configuration vars that are enviromentally specific. You also want them to use nconf goodness (https://github.com/flatiron/nconf). You want the environment to default to being development if process.env.NODE_ENV is undefined. | ||
@@ -30,3 +30,3 @@ Running envi will give you a conf directory that looks like this: | ||
``` | ||
env = require('./config/env'); | ||
env = require('./conf/env'); | ||
console.log(env.hello); //outputs I'm dev by default, otherwise reads process.env.NODE_ENV | ||
@@ -33,0 +33,0 @@ ``` |
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
3721
7
45
0
3
1