Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[dist] Version bump. 0.1.0

  • Loading branch information...
commit ac888dc5a20e119e611ae7400210386624bfe01c 1 parent 0fd847c
@indexzero authored
Showing with 42 additions and 2 deletions.
  1. +23 −1 README.md
  2. +0 −1  lib/nconf/stores/redis.js
  3. +19 −0 package.json
View
24 README.md
@@ -46,12 +46,34 @@ Using nconf is easy; it is designed to be a simple key-value store with support
## Storage Engines
### Memory
+A simple in-memory storage engine that stores a nested JSON representation of the configuration. To use this engine, just call `.use()` with the appropriate arguments. All calls to `.get()`, `.set()`, `.clear()`, `.reset()` methods are synchronous since we are only dealing with an in-memory object.
+<pre>
+ nconf.use('memory');
+</pre>
### File
+Based on the Memory engine, but provides additional methods `.save()` and `.load()` which allow you to read your configuration to and from file. As with the Memory store, all method calls are synchronous with the exception of `.save()` and `.load()` which take callback functions. It is important to note that setting keys in the File engine will not be persisted to disk until a call to `.save()` is made.
+
+<pre>
+ nconf.use('file', { file: 'path/to/your/config.json' });
+</pre>
+
+The file store is also extensible for multiple file formats, defaulting to `JSON`. To use a custom format, simply pass a format object to the `.use()` method. This object must have `.parse()` and `.stringify()` methods just like the native `JSON` object.
### Redis
+The Redis engine will persist all of your configuration settings to a Redis server. All calls to `.get()`, `.set()`, `.clear()`, `.reset()` are asynchronous taking an additional callback parameter.
+
+<pre>
+ nconf.use('redis', { host: 'localhost', port: 6379, ttl: 60 * 60 * 1000 });
+</pre>
+
+The Redis engine also has an in-memory cache with a default TTL of one hour. To change this, just pass the `ttl` option to `.use()`.
## More Documentation
+There is more documentation available through docco. I haven't gotten around to making a gh-pages branch so in the meantime if you clone the repository you can view the docs:
+<pre>
+ open docs/nconf.html
+</pre>
## Run Tests
Tests are written in vows and give complete coverage of all APIs and storage engines.
@@ -59,4 +81,4 @@ Tests are written in vows and give complete coverage of all APIs and storage eng
vows test/*-test.js --spec
</pre>
-#### Author: [Charlie Robbins](http://www.charlierobbins.com)
+#### Author: [Charlie Robbins](http://nodejitsu.com)
View
1  lib/nconf/stores/redis.js
@@ -6,7 +6,6 @@
*/
var async = require('async'),
- eyes = require('eyes'),
redis = require('redis'),
nconf = require('nconf'),
Memory = require('./Memory').Memory;
View
19 package.json
@@ -0,0 +1,19 @@
+{
+ "name": "nconf",
+ "description": "A hybrid local / remote configuration storage library for node.js.",
+ "version": "0.1.0",
+ "author": "Charlie Robbins <charlie.robbins@gmail.com>",
+ "repository": {
+ "type": "git",
+ "url": "http://github.com/indexzero/nconf.git"
+ },
+ "keywords": ["configuration", "key value store", "redis"],
+ "dependencies": {
+ "async": ">= 0.1.8",
+ "redis": ">= 0.5.9",
+ "vows": ">= 0.5.8"
+ },
+ "main": "./lib/nconf",
+ "scripts": { "test": "vows test/*-test.js --spec" },
+ "engines": { "node": ">= 0.4.5" }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.