Updated model index
This commit is contained in:
parent
77979d8fac
commit
aed75b9576
1 changed files with 7 additions and 12 deletions
|
@ -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 => {
|
||||||
|
|
Loading…
Reference in a new issue