2010-10-25 14:30:14 +08:00
|
|
|
var config = {
|
|
|
|
port: 5432,
|
|
|
|
host: 'localhost',
|
|
|
|
user: 'postgres',
|
|
|
|
database: 'postgres',
|
2010-10-26 08:25:51 +08:00
|
|
|
password: '',
|
|
|
|
test: 'unit'
|
2010-10-25 14:30:14 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
var args = process.argv;
|
|
|
|
for(var i = 0; i < args.length; i++) {
|
|
|
|
switch(args[i].toLowerCase()) {
|
|
|
|
case '-u':
|
|
|
|
case '--user':
|
|
|
|
config.user = args[++i];
|
|
|
|
break;
|
|
|
|
case '--password':
|
|
|
|
config.password = args[++i];
|
|
|
|
break;
|
2010-12-20 04:46:43 +08:00
|
|
|
case '--verbose':
|
|
|
|
config.verbose = (args[++i] == "true");
|
|
|
|
break;
|
2010-10-25 14:30:14 +08:00
|
|
|
case '-d':
|
|
|
|
case '--database':
|
|
|
|
config.database = args[++i];
|
|
|
|
break;
|
|
|
|
case '-p':
|
|
|
|
case '--port':
|
|
|
|
config.port = args[++i];
|
|
|
|
break;
|
|
|
|
case '-h':
|
|
|
|
case '--host':
|
|
|
|
config.host = args[++i];
|
|
|
|
break;
|
|
|
|
case '--down':
|
|
|
|
config.down = true;
|
|
|
|
break;
|
2010-10-26 08:25:51 +08:00
|
|
|
case '-t':
|
|
|
|
case '--test':
|
|
|
|
config.test = args[++i];
|
2011-03-02 05:03:51 +08:00
|
|
|
case '--native':
|
|
|
|
config.native = (args[++i] == "true");
|
2010-10-25 14:30:14 +08:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var log = function(keys) {
|
|
|
|
keys.forEach(function(key) {
|
|
|
|
console.log(key + ": '" + config[key] + "'");
|
|
|
|
});
|
|
|
|
}
|
2010-12-20 04:46:43 +08:00
|
|
|
|
2010-10-25 14:30:14 +08:00
|
|
|
module.exports = config;
|