Updated model index

This commit is contained in:
dbroqua 2020-02-18 11:20:10 +01:00
parent 77979d8fac
commit aed75b9576

View file

@ -3,22 +3,17 @@ const path = require("path");
const Sequelize = require("sequelize"); const Sequelize = require("sequelize");
const basename = path.basename(__filename); const basename = path.basename(__filename);
const env = process.env.NODE_ENV || "development"; const env = process.env.NODE_ENV;
// eslint-disable-next-line import/no-dynamic-require // eslint-disable-next-line import/no-dynamic-require
const config = require(`${__dirname}/../config/config.json`)[env]; const config = require(`${__dirname}/../config/config.json`)[env];
const db = {}; const db = {};
let sequelize; const sequelize = new Sequelize(
if (config.use_env_variable) {
sequelize = new Sequelize(process.env[config.use_env_variable], config);
} else {
sequelize = new Sequelize(
config.database, config.database,
config.username, config.username,
config.password, config.password,
config config
); );
}
fs.readdirSync(__dirname) fs.readdirSync(__dirname)
.filter(file => { .filter(file => {