forked from grncdr/node-any-db-adapter-spec
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.js
More file actions
23 lines (18 loc) · 632 Bytes
/
Copy pathconfig.js
File metadata and controls
23 lines (18 loc) · 632 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var path = require('path')
var camelize = require('camelize')
var cc = require('config-chain')
var argv = require('optimist').argv
var parseDbUrl = require('parse-db-url')
var config = cc(camelize(argv),
camelize(cc.env('any_db_test_')),
{ adapterPath: process.cwd() })
var adapterPath = path.resolve(config.get('adapterPath'))
config.set('adapterPath', adapterPath)
config.set('adapter', require(adapterPath))
var url = config.get('url')
if (!url) {
config.set('url', {})
} else if (typeof url == 'string') {
config.set('url', parseDbUrl(config.get('url')))
}
module.exports = config.store