diff --git a/client.js b/client.js index 2427a49..e6828b7 100644 --- a/client.js +++ b/client.js @@ -429,6 +429,9 @@ module.exports.create = function (opts, verbs, mySocket) { } }; + if (opts.init) { + return db.init(opts); + } return db; }); } diff --git a/package.json b/package.json index 74f8584..c5fc936 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sqlite3-cluster", - "version": "1.1.2", + "version": "2.0.0", "description": "A wrapper to enable the use of sqlite3 with node cluster via a socket server (i.e. for Raspberry Pi 2).", "main": "index.js", "scripts": { diff --git a/server.js b/server.js index f248540..fb4135c 100644 --- a/server.js +++ b/server.js @@ -84,7 +84,7 @@ function createApp(servers, options) { switch(cmd.type) { case 'init': - console.log('[S] init', cmd); + //console.log('[S] init', cmd); db[cmd.func].apply(db, cmd.args).then(function () { var args = Array.prototype.slice.call(arguments); var myself; diff --git a/wrapper.js b/wrapper.js index e7c40cd..fdca6e7 100644 --- a/wrapper.js +++ b/wrapper.js @@ -20,7 +20,6 @@ function create(opts, verbs) { var PromiseA = verbs.Promise || require('bluebird'); var dbname = ""; - dbname += (opts.dirname || ''); dbname += (opts.prefix || ''); if (opts.subtenant) { dbname += opts.subtenant + '.'; @@ -31,6 +30,7 @@ function create(opts, verbs) { dbname += (opts.dbname || ''); dbname += (opts.suffix || ''); dbname += (opts.ext || ''); + dbname = require('path').resolve(opts.dirname || '', dbname); function initDb(newOpts) { if (dbs[dbname].initPromise) {