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

Commit c071018a by Roman Shtylman Committed by GitHub

feat(sequelize): handle query string host value (#12041)

1 parent c66663ed
......@@ -211,6 +211,13 @@ class Sequelize {
}
if (urlParts.query) {
// Allow host query argument to override the url host.
// Enables specifying domain socket hosts which cannot be specified via the typical
// host part of a url.
if (urlParts.query.host) {
options.host = urlParts.query.host;
}
if (options.dialectOptions)
Object.assign(options.dialectOptions, urlParts.query);
else
......
......@@ -179,5 +179,12 @@ describe('Sequelize', () => {
expect(dialectOptions.application_name).to.equal('client');
expect(dialectOptions.ssl).to.equal('true');
});
it('should use query string host if specified', () => {
const sequelize = new Sequelize('mysql://localhost:9821/dbname?host=example.com');
const options = sequelize.options;
expect(options.host).to.equal('example.com');
});
});
});
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!