forked from GitHub/dbot
fuck
This commit is contained in:
parent
9aec9f4df4
commit
287b718b17
@ -1,11 +1,13 @@
|
||||
var databank = require('databank'),
|
||||
Databank = databank.Databank,
|
||||
DatabankObject = databank.DatabankObject;
|
||||
DatabankObject = databank.DatabankObject,
|
||||
_ = require('underscore')._;
|
||||
|
||||
/**
|
||||
* Multiplex databank objects
|
||||
*/
|
||||
var DatabaseDriver = function() {
|
||||
var DatabaseDriver = function(config) {
|
||||
this.config = config;
|
||||
this.databanks = {};
|
||||
};
|
||||
|
||||
@ -15,6 +17,7 @@ var DatabaseDriver = function() {
|
||||
DatabaseDriver.prototype.createDB = function(name, driver, schema, callback) {
|
||||
var params = { 'schema': schema };
|
||||
|
||||
if(driver == 'redis' && _.has(this.config, 'redisPort')) params.port = this.config.redisPort;
|
||||
if(driver == 'disk') params.dir = 'db';
|
||||
|
||||
this.databanks[name] = Databank.get(driver, params);
|
||||
|
6
run.js
6
run.js
@ -18,11 +18,11 @@ var DBot = function() {
|
||||
this.db = {};
|
||||
}
|
||||
|
||||
/*** Load the fancy DB ***/
|
||||
this.ddb = new DatabaseDriver();
|
||||
|
||||
this.reloadConfig();
|
||||
|
||||
/*** Load the fancy DB ***/
|
||||
this.ddb = new DatabaseDriver(this.config);
|
||||
|
||||
/*** Load main strings ***/
|
||||
try {
|
||||
this.strings = JSON.parse(fs.readFileSync('strings.json', 'utf-8'));
|
||||
|
Loading…
Reference in New Issue
Block a user