Commit graph

133 commits

Author SHA1 Message Date
Charlie Robbins
818526ca62 Merge pull request from SchoonologyRRL/patch-1
Updated Memory.merge to handle null values
2012-12-20 22:56:54 -08:00
Michael Hart
bb57c497d3 Prefer this fix for to 6045618 2012-12-20 18:12:42 -05:00
indexzero
60456186d7 [fix] Fix for 2012-12-20 18:03:37 -05:00
Michael Schoonmaker
ed41c51850 Updated Memory.merge to handle null values
Previously, if the Memory store was merged with an object containing a null value, the following Error occurred:

TypeError: Object.keys called on non-object
    at Function.keys (native)
    at Memory.merge (/.../node_modules/nconf/lib/nconf/stores/memory.js:199:17)
    at Memory.merge (/.../node_modules/nconf/lib/nconf/stores/memory.js:200:17)
    at Array.every (native)
    at Memory.merge (/.../node_modules/nconf/lib/nconf/stores/memory.js:199:29)
    at common.merge (/.../node_modules/nconf/lib/nconf/common.js:99:13)
    at Array.forEach (native)
    at common.merge (/.../node_modules/nconf/lib/nconf/common.js:98:22)
    at Array.forEach (native)
    at Object.common.merge (/.../node_modules/nconf/lib/nconf/common.js:97:8)

This commit prevents that.
2012-09-27 11:26:56 -07:00
Christian Tellnes
8e987b8d3d make it possible to use other formats than json in common.loadFiles and common.loadFilesSync 2012-09-16 17:45:00 +02:00
Bradley Meck
da39d3cac3 [fix] null values should merge properly instead of throwing errors 2012-09-08 20:10:58 -05:00
Bradley Meck
683f78918c [fix] root get/set should work via null/undefined as key 2012-09-07 09:29:30 -05:00
indexzero
d96d2544bc [fix] Fix regression introduced by 36e061c4bd 2012-07-10 03:16:54 -04:00
indexzero
30734301e7 [api test doc] Make options to Provider.prototype.file take more flexible options 2012-07-10 01:50:18 -04:00
indexzero
7515f66572 [fix] Ensure that all options are passed to Provider.prototype.add in Provider.prototype.file. Fixes
[doc] Update README.md and method documentation
[dist] Remove vim comments
2012-07-10 01:27:28 -04:00
Michael Hart
9aaafc5a22 Ugh, fixed whitespace 2012-06-21 18:05:52 +10:00
Michael Hart
3c08fad1c9 Changed to as it's more accurate 2012-06-21 18:04:37 +10:00
Michael Hart
e15f787940 Updated README and allowed a simpley syntax 2012-06-21 17:18:22 +10:00
Michael Hart
8921d0502e Added support for nested configs via env 2012-06-21 16:46:10 +10:00
Michael Hart
6cbc323005 Add reset to the list of destructive commands 2012-06-14 19:40:28 +05:30
Michael Hart
26d81e8dca Merge objects if necessary when traversing stores on get() 2012-06-13 18:28:54 +05:30
Christian Tellnes
83440f9956 fix spelling in error message 2012-05-24 07:27:19 +02:00
Maciej Małecki
87b0dd01c9 [minor] Use fs.exists when available
`path.exists*` was moved to `fs` module in
joyent/node@e10ed097cb.
2012-05-15 11:02:46 +02:00
Jonathan Stewmon
6353d028f7 api and doc change for (.file may now take a string instead of an object)
Conflicts:

	lib/nconf/provider.js
2012-05-03 17:10:19 -07:00
Russell Frank
36e061c4bd Fixes to Provider.save() and tests.
Fixed `Provider.save()` to properly ignore stores which do not provide
a saveSync method.  Also, fixed `save()` to properly save asynchronously
when an async `save()` method on a store is provided.

Removed the tests from `nconf-test.js` which expected `save()` to throw
or return an error when a store without `save()` methods was
encountered. Also removed a `console.log` from `provider-test.js`.
2012-05-01 22:44:15 -04:00
Pavan Kumar Sunkara
29eb5f905d [minor] Fix whitespaces 2012-04-15 00:58:55 +05:30
Jordan Harband
6ce0b7aef3 Surfacing additional JSON.stringify arguments in formats.json.stringify, and adding the json_spacing option to the File constructor. 2012-04-13 13:22:42 -07:00
Maciej Małecki
b3699314cf [minor] Use fs.existsSync when available
`path.exists*` was moved to `fs` module in
joyent/node@e10ed097cb.
2012-03-29 13:13:16 +02:00
indexzero
6242caafda [api minor] Add .loadSync() to Memory store. Fixes 2012-01-02 17:20:06 -05:00
indexzero
9e9e37bb84 [minor] Update whitespace 2012-01-02 17:14:03 -05:00
Jonathan Stewmon
a216336290 updated Provider.load to respect sources hierarchy 2012-01-02 17:11:51 -05:00
Jonathan Stewmon
5c43d546d1 fixed merge issue in Provider.load by reversing store keys in getStores 2012-01-02 17:11:31 -05:00
Jonathan Stewmon
2804b1fb37 fixed issue caused by using same name for defaults and overrides 2012-01-02 17:11:24 -05:00
Maciej Małecki
963387cfd4 [api] File.saveSync() should return store content
Fixes .
2011-12-25 15:30:48 +01:00
indexzero
6c720ee109 [dist] Update Copyright and Author to Nodejitsu Inc. 2011-11-24 00:33:08 -05:00
indexzero
53d854a789 [api] Default to options if options.store is not available in nconf.Literal 2011-11-24 00:30:27 -05:00
indexzero
f4f1fdf464 [fix test] Update to respected .sources option correctly 2011-11-24 00:30:14 -05:00
indexzero
bbcb2712f1 [api fix] Dont eagerly create config files in .load() and .loadSync() 2011-11-24 00:30:11 -05:00
indexzero
16a18bffe6 [refactor] Expose all store prototypes on nconf.*. Expose store instances on Provider.stores and Provider.sources 2011-11-24 00:29:43 -05:00
indexzero
c3cebe7cb4 [refactor] Rename .sources to ._stores and bring back ._sources 2011-11-24 00:29:39 -05:00
indexzero
78ce55602f [minor] Dont allow .set() calls to change values in readOnly stores: argv, env, and literal 2011-11-24 00:29:35 -05:00
indexzero
c3c315d648 [refactor] Refactor to make using nconf more fluent. 2011-11-24 00:29:15 -05:00
Maciej Małecki
1b258bf5b3 [fix] Fix option parsing
See .
2011-11-22 02:06:09 +01:00
Maciej Małecki
bbc5885fc1 [api] Reparse argv arguments on system.loadArgv()
It allows manipulating `process.argv` on the fly while still being able
to use nconf `System` store.
2011-11-19 01:58:08 +01:00
indexzero
2e33082f0b [api] Automatically search for a file if options.search is true in File store 2011-10-22 02:36:45 -04:00
indexzero
a2464d244b [api] Load sources into the default system store so they are permenantly cached 2011-09-25 00:46:28 -04:00
indexzero
d0aee0d451 [api test] Added .sources option for nconf.Provider for readonly configuration data 2011-09-25 00:01:44 -04:00
indexzero
0234e17804 [fix] Update bad variable reference 2011-09-24 23:40:57 -04:00
indexzero
a490c7729b [fix] Match case in require statements 2011-09-19 13:51:17 -07:00
indexzero
1ef5797e83 [api test] Finished API and tests for hierarchical configuration storage. 2011-09-18 21:37:01 -04:00
indexzero
da2da7aea8 [api test breaking refactor] Significant refactor to how nconf works. Now a fully hierarchical configuration storage mechanism capable of multiple levels of stores of the same type. 2011-09-16 06:49:47 -04:00
indexzero
2bda7b6216 [api] Added nconf.stores.System 2011-09-13 07:38:41 -04:00
indexzero
e631d239d5 [fix] Lazy-load any CLI arguments from optimist 2011-08-29 15:19:55 -04:00
indexzero
fb392ddc51 [api test] Updated test/provider-test.js and associated merge implementation 2011-08-28 08:50:26 -04:00
indexzero
e8904e95c6 [api] Added nconf.loadFiles() method 2011-08-23 06:53:05 -04:00
indexzero
a6533aa7bf [dist api test] Finished integrating features from reconf and updating associated tests 2011-08-23 06:38:51 -04:00
indexzero
add8922c04 [api dist] Begin to integrate features from reconf 2011-08-22 20:17:28 -04:00
indexzero
8620e6ba91 [api test] Remove Redis store in preparation for nconf-redis 2011-07-08 15:33:33 -04:00
indexzero
7e4623ec46 [api test] Update nconf.Provider to create a new instance of the store if the options are different 2011-06-25 00:34:07 -04:00
indexzero
d8b5a80280 [minor] Small style updates to the File store 2011-06-24 03:31:26 -04:00
Marak Squires
c43685160d [refactor]: Cleaned up error handling on File.loadSync and File.load
[refactor]: Using path module to determine if file exists instead of throwing error
[api]: File.load and File.loadSync will now automatically create the requested JSON file path if no file is found.
2011-06-23 18:06:26 -07:00
Dominic Tarr
6c6887a850 move callback outside of try / catch
it's dangerous to callback inside try, because you may catch unexpected throws in callback.
2011-06-12 15:45:02 -07:00
indexzero
76db254740 [fix test] Update nconf.stores.File to respond with an error when loading malformed JSON async 2011-06-08 00:06:58 -04:00
indexzero
f611066b60 [dist] Update to pkginfo 0.2.0 2011-06-07 23:45:01 -04:00
indexzero
13f5753405 [minor] Update nconf.version to use pkginfo 2011-06-05 01:39:39 -04:00
indexzero
c9e60d96b5 [doc] Update code docs 2011-06-05 01:35:54 -04:00
indexzero
4459ba54a1 [api] Added .merge() to stores.Memory and stores.Redis 2011-06-05 01:29:14 -04:00
indexzero
c21ab02f44 Merge branch 'master' of https://github.com/samsonjs/nconf 2011-05-23 16:58:12 -04:00
Sami Samhuri
6acc1fc533 allow storing null in redis 2011-05-22 12:40:57 -07:00
Sami Samhuri
faa8ab9486 correctly retrieve falsy values from memory (hence file) 2011-05-22 12:40:57 -07:00
avian
e7c216e970 [minor] Clarified error message returned when a config file contains invalid JSON. 2011-05-20 01:16:22 -07:00
indexzero
87351caac8 [fix] Use the memory engine by default 2011-05-16 22:44:46 -04:00
indexzero
9da37dff2a [dist api test] Refactor pluggable nconf-level logic into nconf.Provider. Update .gitignore for npm 1.0. Update pathing in source and tests to be more require.paths future-proof 2011-05-14 01:47:26 -04:00
indexzero
4a61560671 [dist] Version bump. 0.1.7 2011-04-20 01:58:46 -04:00
indexzero
d65922dc7a [api] Add .saveSync() and .loadSync() methods to File store 2011-04-20 01:57:56 -04:00
indexzero
b9951b44c1 [dist] Version bump. 0.1.6. 2011-04-19 17:34:42 -04:00
indexzero
067d58a99d [minor test] Add tests for File store save(). Improve default file format to pretty print the JSON output 2011-04-19 17:32:13 -04:00
indexzero
d99ab32cc5 [fix] Dont allow async.forEach to be called on undefined or null arrays 2011-04-13 18:49:38 -04:00
indexzero
04a59e93d6 [fix] Supress errors from Redis 2011-04-05 03:53:17 -04:00
indexzero
4094125b30 [api] Add support for Redis auth and optional callbacks. 2011-04-05 00:09:46 -04:00
indexzero
b850ae2dd0 [fix] Update path to require statement in Redis store 2011-04-03 14:19:02 -04:00
indexzero
752bb980ac [api] Improve the .use() method. Use the memory engine by default 2011-04-02 19:17:04 -04:00
indexzero
ac888dc5a2 [dist] Version bump. 0.1.0 2011-04-02 05:13:34 -04:00
indexzero
79717ac3b1 [test] More tests for nconf 2011-04-02 04:41:50 -04:00
indexzero
09b8c75383 [api test doc] Internal fixes from testing. More tests and docs 2011-04-02 04:31:20 -04:00
indexzero
73bf78339f [api doc test] Finalize API. Add more test coverage 2011-04-02 03:03:16 -04:00
indexzero
4c8e7a5b7f [api] More work on Redis store 2011-03-31 04:11:11 -04:00
indexzero
67b5c8ab2a [api test] First pass at implementation 2011-03-31 02:32:47 -04:00