Permalink
Browse files

Merge pull request #23 from enyo/adding-local

Adding local
  • Loading branch information...
2 parents f59efa7 + 0de79f4 commit c06e19f921940a923ec34ba79c1d244a6151e323 @lorenwest committed May 7, 2012
Showing with 32 additions and 2 deletions.
  1. +5 −0 History.md
  2. +3 −1 lib/config.js
  3. +12 −0 test/2-config-test.js
  4. +3 −1 test/config/default.json
  5. +5 −0 test/config/local-test.json
  6. +4 −0 test/config/local.yaml
View
@@ -1,3 +1,8 @@
+0.4.14 / 2012-04-27
+===================
+
+ * Added the local.EXT and local-deployment.EXT configs.
+
0.4.13 / 2012-04-25
===================
View
@@ -527,6 +527,8 @@ Config.prototype._persistConfigsOnChange = function(objectToWatch) {
* (hostname).EXT
* (deployment).EXT
* (hostname)-(deployment).EXT
+ * local.EXT
+ * local-(deployment).EXT
* runtime.json
* </pre>
*
@@ -579,7 +581,7 @@ Config.prototype._loadFileConfigs = function() {
var deployment = process.env.NODE_ENV || 'development';
// Read each file in turn
- var baseNames = ['default', hostName, deployment, hostName + '-' + deployment];
+ var baseNames = ['default', hostName, deployment, hostName + '-' + deployment, 'local', 'local-' + deployment];
var extNames = ['js', 'json', 'coffee', 'yaml'];
baseNames.forEach(function(baseName) {
extNames.forEach(function(extName) {
View
@@ -49,6 +49,18 @@ exports.ConfigTest = vows.describe('Test suite for node-config').addBatch({
assert.equal(CONFIG.AnotherModule.parm3, 'value3');
},
+ 'Loading configurations from an environment file is correct': function() {
+ assert.equal(CONFIG.Customers.dbPort, '5999');
+ },
+
+ 'Loading configurations from the local file is correct': function() {
+ assert.equal(CONFIG.Customers.dbPassword, 'real password');
+ },
+
+ 'Loading configurations from the local environment file is correct': function() {
+ assert.equal(CONFIG.Customers.dbPassword2, 'another password');
+ },
+
'Loading prior runtime.json configurations is correct': function() {
assert.equal(CONFIG.Customers.dbName, 'override_from_runtime_json');
}
View
@@ -1,6 +1,8 @@
{
"Customers": {
- "dbName":"from_default_json"
+ "dbName":"from_default_json",
+ "dbPassword":"password will be overwritten.",
+ "dbPassword2":"password will be overwritten."
},
"AnotherModule": {
"parm1":"value1"
@@ -0,0 +1,5 @@
+{
+ "Customers": {
+ "dbPassword2":"another password"
+ }
+}
View
@@ -0,0 +1,4 @@
+
+Customers:
+ dbPassword: real password
+

0 comments on commit c06e19f

Please sign in to comment.