From b639f8c8b2104f7f0ae9c5a3d0a9e85ea9f5fbdc Mon Sep 17 00:00:00 2001 From: Jeff Kunkle Date: Tue, 13 Dec 2011 10:53:42 -0500 Subject: [PATCH] Add database.json configuation --- .gitignore | 1 - database.json | 11 +++++++++++ lib/config.js | 16 ++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 database.json create mode 100644 lib/config.js diff --git a/.gitignore b/.gitignore index bc9a3923..41c4de95 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ migrations/ node_modules/ -database.json diff --git a/database.json b/database.json new file mode 100644 index 00000000..17ba6ff2 --- /dev/null +++ b/database.json @@ -0,0 +1,11 @@ +{ + "development": { + "driver": "sqlite3", + "filename": ":memory:" + }, + + "test": { + "driver": "sqlite3", + "filename": ":memory:" + } +} diff --git a/lib/config.js b/lib/config.js new file mode 100644 index 00000000..d72d1f59 --- /dev/null +++ b/lib/config.js @@ -0,0 +1,16 @@ +exports.load = function(path) { + var config = require(path); + + for (var env in config) { + exports[env] = config[env]; + } + + exports.setCurrent = function(env) { + exports.getCurrent = function() { + return exports[env]; + } + } + + delete exports.load; +}; +