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

Commit bec48757 by Thomas Wickham

pg: remove useless connection string

1 parent 93261e90
Showing with 8 additions and 4 deletions
...@@ -20,12 +20,16 @@ Utils._.extend(ConnectionManager.prototype, AbstractConnectionManager.prototype) ...@@ -20,12 +20,16 @@ Utils._.extend(ConnectionManager.prototype, AbstractConnectionManager.prototype)
ConnectionManager.prototype.connect = function(config) { ConnectionManager.prototype.connect = function(config) {
var self = this var self = this
, clientConfig = {}; , connectionConfig = {};
config.user = config.username; config.user = config.username;
connectionConfig = Utils._.pick(config, [
'user', 'password', 'host', 'database', 'port'
]);
if (config.dialectOptions) { if (config.dialectOptions) {
clientConfig = Utils._.pick(config.dialectOptions, [ Utils._.merge(connectionConfig,
Utils._.pick(config.dialectOptions, [
// see [http://www.postgresql.org/docs/9.3/static/runtime-config-logging.html#GUC-APPLICATION-NAME] // see [http://www.postgresql.org/docs/9.3/static/runtime-config-logging.html#GUC-APPLICATION-NAME]
'application_name', 'application_name',
// choose the SSL mode with the PGSSLMODE environment variable // choose the SSL mode with the PGSSLMODE environment variable
...@@ -40,11 +44,11 @@ ConnectionManager.prototype.connect = function(config) { ...@@ -40,11 +44,11 @@ ConnectionManager.prototype.connect = function(config) {
// (unless you know what you're doing) // (unless you know what you're doing)
// see [http://www.postgresql.org/message-id/flat/bc9549a50706040852u27633f41ib1e6b09f8339d845@mail.gmail.com#bc9549a50706040852u27633f41ib1e6b09f8339d845@mail.gmail.com] // see [http://www.postgresql.org/message-id/flat/bc9549a50706040852u27633f41ib1e6b09f8339d845@mail.gmail.com#bc9549a50706040852u27633f41ib1e6b09f8339d845@mail.gmail.com]
'binary' 'binary'
]); ]));
} }
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
var connection = new self.lib.Client(clientConfig) var connection = new self.lib.Client(connectionConfig)
, 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!