Skip to content

Commit

Permalink
Making possible to use database port other than 3306
Browse files Browse the repository at this point in the history
  • Loading branch information
griiettner committed Aug 10, 2016
1 parent 35c960a commit d5b6f0c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ var MySQL = require('mysql'),
var Db = module.exports;

Db.connect = function (callback) {
Db.client = MySQL.createConnection({
var host = config.configuration.host.split(':');

Db.client = MySQL.createClient({
user: config.configuration.user,
password: config.configuration.password,
host: config.configuration.host,
database: config.configuration.db
host: host[0],
database: config.configuration.db,
port: host[1] == undefined ? 3306 : host[1]
});
};

Expand All @@ -23,5 +26,5 @@ Db.query = function (query_string, callback) {
}

callback(results);
});
});
};

0 comments on commit d5b6f0c

Please sign in to comment.