'use strict';

// Set environment
process.env.NODE_ENV = process.env.NODE_ENV || 'development';

// Load dotenv
const path = require('path');
require('dotenv').config({
    path: path.join(__dirname, '..', '.env')
});

// Set log4js config
process.env.LOG4JS_CONFIG = path.join(__dirname, '..', 'log4js.json');

const _ = require('lodash');

let config = {
    env: process.env.NODE_ENV,
    node_id: parseInt(process.env.NODE_ID || 0),
    database: {
        url: process.env.MYSQL_URI,
        dialect: 'mysql',
        migrationStorageTableName: 'sequelize_migrations',
        pool: {
            max: 5,
            min: 1,
            idle: 10000
        }
    },
    shutdownInterval: 1000,
    workers: require('./workers')
};

// For sequelize-cli
_.each(['development', 'production', 'test'], env => {
    config[env] = _.clone(config.database);
    if (env === 'test') {
        config[env]['url'] = process.env.MYSQL_URI_TEST;
    }
});

module.exports = config;

@@ -8,16 +8,76 @@
 rict';%0A%0A
+const _ = require('lodash');%0Aconst path = require('path');%0A%0A
 // Set e
@@ -153,250 +153,207 @@
 t';%0A
-%0A
 // 
-Load dotenv%0Aconst path = require('path');%0Arequire('dotenv').config(%7B%0A    path: path.join(__dirname, '..', '.env')%0A%7D);%0A%0A// Set log4js config%0Aprocess.env.LOG4JS_CONFIG = path.join(__dirname, '..', 'log4js.json');%0A%0Aconst _ = require('lodash'
+Set log4js config%0Aprocess.env.LOG4JS_CONFIG = path.join(__dirname, '..', 'log4js.json');%0A%0A// Load dotenv%0Arequire('dotenv').config(%7B%0A    path: path.join(__dirname, '..', '.env'),%0A    silent: true%0A%7D
 );%0A%0A
@@ -754,21 +754,17 @@
 %0A// 
-For s
+S
 equelize
 -cli
@@ -763,12 +763,21 @@
 lize
--cli
+ environments
 %0A_.e

Refactor config