diff --git a/README.md b/README.md index 79def22..1d1491f 100644 --- a/README.md +++ b/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. +
+  nconf.use('memory');
+
### 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. + +
+  nconf.use('file', { file: 'path/to/your/config.json' });
+
+ +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. + +
+  nconf.use('redis', { host: 'localhost', port: 6379, ttl: 60 * 60 * 1000 });
+
+ +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: +
+  open docs/nconf.html
+
## 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 -#### Author: [Charlie Robbins](http://www.charlierobbins.com) \ No newline at end of file +#### Author: [Charlie Robbins](http://nodejitsu.com) \ No newline at end of file diff --git a/lib/nconf/stores/redis.js b/lib/nconf/stores/redis.js index 4b3d900..592f213 100644 --- a/lib/nconf/stores/redis.js +++ b/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; diff --git a/package.json b/package.json new file mode 100644 index 0000000..ecf8eae --- /dev/null +++ b/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 ", + "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" } +}