import Sequelize from "sequelize" ; import logger from "../config/logger" ; import { getNodeEnv } from "../util/isNodeEnv" ; import { EnvironmentEnum } from "../interfaces/common" ; const nodeEnv = getNodeEnv ( ) || EnvironmentEnum . development ; const config = require ( "../../db/config.json" ) [ nodeEnv ] ; config . benchmark = true ; config . logging = config . disable_sql_logging ? undefined : ( query , ms ) => logger . trace ( { ms } , query ) ; export const sequelize = config . use_env_variable ? new Sequelize . Sequelize ( process . env [ config . use_env_variable ] || "DATABASE_URL" , config ) : new Sequelize . Sequelize ( config ) ;