Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Adding local #23

Merged
merged 2 commits into from

2 participants

Matias Meno Loren West
Matias Meno

As requested, a new pull request for the local config files.

Loren West lorenwest merged commit c06e19f into from
Loren West
Owner

Thank you for the checkin with tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 27, 2012
  1. Matias Meno

    Added a test for the environment.

    enyo authored
  2. Matias Meno
This page is out of date. Refresh to see the latest.
5 History.md
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
===================
4 lib/config.js
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) {
12 test/2-config-test.js
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');
}
4 test/config/default.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"
5 test/config/local-test.json
View
@@ -0,0 +1,5 @@
+{
+ "Customers": {
+ "dbPassword2":"another password"
+ }
+}
4 test/config/local.yaml
View
@@ -0,0 +1,4 @@
+
+Customers:
+ dbPassword: real password
+
Something went wrong with that request. Please try again.