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

Commit b5ae217f by Thomas Wickham

pg: remove the useless connection string

1 parent 1f788071
Showing with 24 additions and 3 deletions
...@@ -19,11 +19,32 @@ ConnectionManager = function(dialect, sequelize) { ...@@ -19,11 +19,32 @@ ConnectionManager = function(dialect, sequelize) {
Utils._.extend(ConnectionManager.prototype, AbstractConnectionManager.prototype); Utils._.extend(ConnectionManager.prototype, AbstractConnectionManager.prototype);
ConnectionManager.prototype.connect = function(config) { ConnectionManager.prototype.connect = function(config) {
var self = this; var self = this
, clientConfig = {};
config.user = config.username;
if (config.dialectOptions) {
clientConfig = Utils._.pick(config.dialectOptions, [
// see [http://www.postgresql.org/docs/9.3/static/runtime-config-logging.html#GUC-APPLICATION-NAME]
'application_name',
// choose the SSL mode with the PGSSLMODE environment variable
// object format: [https://github.com/brianc/node-postgres/blob/master/lib/connection.js#L79]
// see also [http://www.postgresql.org/docs/9.3/static/libpq-ssl.html]
'ssl',
// In addition to the values accepted by the corresponding server,
// you can use "auto" to determine the right encoding from the
// current locale in the client (LC_CTYPE environment variable on Unix systems)
'client_encoding',
// !! DONT SET THIS TO TRUE !!
// (unless you know what you're doing)
// see [http://www.postgresql.org/message-id/flat/bc9549a50706040852u27633f41ib1e6b09f8339d845@mail.gmail.com#bc9549a50706040852u27633f41ib1e6b09f8339d845@mail.gmail.com]
'binary'
]);
}
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
var connectionString = self.sequelize.getQueryInterface().QueryGenerator.databaseConnectionUri(config) var connection = new self.lib.Client(clientConfig)
, connection = new self.lib.Client(connectionString)
, responded = false; , responded = false;
connection.connect(function(err) { connection.connect(function(err) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!