Commit a2eac148 authored by Vincent Horvath's avatar Vincent Horvath
Browse files

fixed db connection configuration

parent 6e6860a2
......@@ -2,9 +2,9 @@ var mysql = require('mysql');
var connection = null;
module.exports = {
getConnection: function (localConfig) {
getConnection: function () {
if (connection == null) {
connection = mysql.createConnection(getConfiguration(localConfig));
connection = mysql.createConnection(getConfiguration());
connection.connect(function (err) {
if (!err) {
console.log("Database is connected ...");
......@@ -18,7 +18,7 @@ module.exports = {
}
};
function getConfiguration(localConfig) {
function getConfiguration() {
if (process.env.PRODUCTION) {
return {
host: process.env.DB_HOST,
......@@ -27,7 +27,7 @@ function getConfiguration(localConfig) {
database: process.env.DB_SCHEMA,
};
} else {
return localConfig
return require('../conig/main-local.json').db;
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment