Skip to content

Commit daea081

Browse files
committed
Removing unnecessary config modifications
Since @felixge/node-mysql manages the required configurations itself, there is no need to truncate config on the sails-mysql side https://github.com/felixge/node-mysql/blob/v2.0.0-alpha8/lib/ConnectionConfig.js
1 parent 9eae817 commit daea081

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

lib/adapter.js

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,7 @@ module.exports = (function() {
8787

8888
// Create a Connection Pool if set
8989
if (def.config.pool) {
90-
adapter.pool = mysql.createPool(_.extend(marshalConfig(def.config), {
91-
connectionLimit: def.config.connectionLimit,
92-
waitForConnections: def.config.waitForConnections
93-
}));
90+
adapter.pool = mysql.createPool(def.config);
9491
}
9592

9693
return cb();
@@ -544,7 +541,7 @@ module.exports = (function() {
544541

545542
// Use a new connection each time
546543
if (!config.pool) {
547-
var connection = mysql.createConnection(marshalConfig(config));
544+
var connection = mysql.createConnection(config);
548545
connection.connect(function(err) {
549546
afterwards(err, connection);
550547
});
@@ -602,27 +599,13 @@ module.exports = (function() {
602599
console.error(err);
603600

604601

605-
connection = mysql.createConnection(marshalConfig(config));
602+
connection = mysql.createConnection(config);
606603
connection.connect();
607604
// connection = mysql.createConnection(connection.config);
608605
// handleDisconnect(connection);
609606
// connection.connect();
610607
});
611608
}
612609

613-
// Convert standard adapter config
614-
// into a custom configuration object for node-mysql
615-
function marshalConfig(config) {
616-
return {
617-
host: config.host,
618-
port: config.port || 3306,
619-
socketPath: config.socketPath || null,
620-
user: config.user,
621-
password: config.password,
622-
database: config.database,
623-
timezone: config.timezone || 'Z'
624-
};
625-
}
626-
627610
return adapter;
628611
})();

0 commit comments

Comments
 (0)