Skip to content

Instantly share code, notes, and snippets.

@ozw-sei
Created August 6, 2015 09:11
Show Gist options
  • Save ozw-sei/2935f750b37c9c6ac003 to your computer and use it in GitHub Desktop.
Save ozw-sei/2935f750b37c9c6ac003 to your computer and use it in GitHub Desktop.
/**
* DB Connection
* @type {{host, user, password, database}}
*/
var params = (function(){
if(sails.config.environment == 'production'){
return {
host: sails.config.connections.prodMysqlServer.host,
user: sails.config.connections.prodMysqlServer.user,
password: sails.config.connections.prodMysqlServer.password,
database: sails.config.connections.prodMysqlServer.database
};
}else{
return {
host: sails.config.connections.someMysqlServer.host,
user: sails.config.connections.someMysqlServer.user,
password: sails.config.connections.someMysqlServer.password,
database: sails.config.connections.someMysqlServer.database
};
}
})();
//sails.config.enums.
var knex = require('knex')({
client: 'mysql',
connection: params
});
module.exports = knex;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment