Skip to content

Commit

Permalink
0.5.8 Supports directly supplying couchdb url
Browse files Browse the repository at this point in the history
  • Loading branch information
dscape committed Aug 20, 2011
1 parent 49ea6bc commit 38668f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion nano.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ var request = require('request')
module.exports = exports = nano = function database_module(cfg) { module.exports = exports = nano = function database_module(cfg) {
var public_functions = {}; var public_functions = {};
if(typeof cfg === "string") { if(typeof cfg === "string") {
cfg = require(cfg); // no cfg? maybe it's a file path? try {
cfg = require(cfg); // no cfg? maybe it's a file path?
}
catch(e) {
cfg = {url: cfg}; // not a file path? guess it's the url
}
} }
if(cfg.proxy) { if(cfg.proxy) {
request = request.defaults({proxy: cfg.proxy}); // proxy support request = request.defaults({proxy: cfg.proxy}); // proxy support
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,7 @@
{ "name": "nano" { "name": "nano"
, "description": "minimalistic couchdb driver for node.js" , "description": "minimalistic couchdb driver for node.js"
, "homepage": "http://github.com/dscape/nano" , "homepage": "http://github.com/dscape/nano"
, "version": "0.5.7" , "version": "0.5.8"
, "author": "Nuno Job <nunojobpinto@gmail.com> (http://nunojob.com)" , "author": "Nuno Job <nunojobpinto@gmail.com> (http://nunojob.com)"
, "keywords": ["couchdb", "data", "request", "json", "nosql", "micro", "nano"] , "keywords": ["couchdb", "data", "request", "json", "nosql", "micro", "nano"]
, "dependencies": {"request": "~2.0.5", "underscore": "~1.1.7"} , "dependencies": {"request": "~2.0.5", "underscore": "~1.1.7"}
Expand Down

0 comments on commit 38668f0

Please sign in to comment.