This commit is contained in:
newtbot
2024-01-10 03:30:53 +08:00
parent ce2b776920
commit aa79f2873f
6 changed files with 526 additions and 74 deletions

View File

@ -3,6 +3,7 @@ const path = require('path')
require('dotenv').config({ path: path.resolve(__dirname, '../.env') })
const Sequelize = require("sequelize");
const fs = require('fs');
const { escape } = require("querystring");
const sequelize = new Sequelize(
"eco_saver",
@ -11,12 +12,17 @@ const sequelize = new Sequelize(
{
host: "mpsqldatabase.mysql.database.azure.com",
dialect: 'mysql',
// attributeBehavior?: 'escape' | 'throw' | 'unsafe-legacy';
attributeBehavior: 'escape',
dialectOptions: {
ssl: {
ca: fs.readFileSync(path.resolve(__dirname, '../cert/DigiCertGlobalRootCA.crt.pem')),
}
},
},
}
},
);
sequelize.authenticate().then(() => {