From 4da66e737ad10602fe41b680c66d417e4d410119 Mon Sep 17 00:00:00 2001 From: Adrien Chauve Date: Thu, 23 Nov 2023 11:50:08 +0100 Subject: [PATCH] fix: use db config in app as well, not only for migration --- src/db/models/index.ts | 5 +++-- src/services/config.ts | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/db/models/index.ts b/src/db/models/index.ts index 062489d0..4b64aa71 100644 --- a/src/db/models/index.ts +++ b/src/db/models/index.ts @@ -1,13 +1,14 @@ import { Sequelize } from "sequelize"; +import dbConfig from "../config/config"; import config from "../../services/config"; import psychologist from "./psychologist"; -export const sequelize = new Sequelize(config.postgre.url, { +export const sequelize = new Sequelize(dbConfig.url, { + ...dbConfig, define: { freezeTableName: true, }, - dialect: "postgres", logging: config.postgre.logging ? console.log : false, }); diff --git a/src/services/config.ts b/src/services/config.ts index 9b53a547..c2e88574 100644 --- a/src/services/config.ts +++ b/src/services/config.ts @@ -43,7 +43,6 @@ export default { minScoreAddress: parseFloat(process.env.MIN_SCORE_ADDRESS || "0.30"), postgre: { logging: parseBoolean(process.env.DB_LOGGING_ENABLE), - url: process.env.DATABASE_URL || "postgres://localhost:5432/monpsysante", }, supportMail: process.env.SUPPORT_MAIL, reportingMailRecipients: process.env.REPORTING_MAIL_RECIPIENTS,