不要怂,就是干,撸起袖子干!

Commit 2980936d by Mick Hansen

Merge pull request #2938 from ksmithut/master

Fixes authentication credentials not being passed in db connection string, and passing options
2 parents 7733bd7d 643da620
Showing with 12 additions and 1 deletions
......@@ -104,6 +104,9 @@ module.exports = (function() {
if (arguments.length === 1 || (arguments.length === 2 && typeof username === 'object')) {
options = username || {};
urlParts = url.parse(arguments[0]);
// reset username and password to null so we don't pass the options as the username
username = null;
password = null;
// SQLite don't have DB in connection url
if (urlParts.pathname) {
......@@ -1066,7 +1069,7 @@ module.exports = (function() {
if (last && Utils._.isPlainObject(last) && last.hasOwnProperty('logging')) {
options = last;
// remove options from set of logged arguments
args.splice(args.length-1, 1);
} else {
......
......@@ -84,6 +84,14 @@ describe(Support.getTestDialectTeaser('Configuration'), function() {
done();
});
it('should work with no authentication options and passing additional options', function() {
var sequelize = new Sequelize('mysql://example.com:9821/dbname', {});
var config = sequelize.config;
expect(config.username).to.not.be.ok;
expect(config.password).to.be.null;
});
it('should use the default port when no other is specified', function() {
var sequelize = new Sequelize('dbname', 'root', 'pass', {
dialect: dialect
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!