Permalink
Browse files

Determine env automatically

  • Loading branch information...
1 parent c226271 commit 1d75e4a7b164bfc86ec7aa6b5aed2357fce2c0e1 @Qard committed Dec 13, 2011
Showing with 4 additions and 4 deletions.
  1. +3 −3 index.js
  2. +1 −1 package.json
View
@@ -24,7 +24,7 @@ function addMProp (o, n, d) {
return m
}
m = v
- return this
+ return o
}
}
@@ -78,7 +78,7 @@ var jsonfig = {
// Parse and insert env data or whole structure into obj.
var json = JSON.parse(data)
- obj[p.basename(file, '.json')] = json[self.env().toLowerCase()] || json
+ obj[p.basename(file, '.json')] = json[self.env()] || json
attempt()
})
@@ -89,7 +89,7 @@ var jsonfig = {
}
// Add chainable masked property modifiers.
-addMProp(jsonfig, 'env', 'development')
+addMProp(jsonfig, 'env', (process.env.NODE_ENV || '').toLowerCase())
addMProp(jsonfig, 'path', __dirname)
// Export jsonfig.
View
@@ -2,7 +2,7 @@
"author": "Stephen Belanger <admin@stephenbelanger.com> (http://stephenbelanger.com)",
"name": "jsonfig",
"description": "Simple json config folder manager",
- "version": "0.0.2",
+ "version": "0.0.3",
"repository": {
"url": "git://github.com/Qard/jsonfig.git"
},

0 comments on commit 1d75e4a

Please sign in to comment.