Skip to content

Commit

Permalink
Merge pull request #21 from LucaSpiritini/configdb
Browse files Browse the repository at this point in the history
best perfomances config db
  • Loading branch information
Nanomarquez committed Nov 9, 2022
2 parents b29265f + 1bbba43 commit 8de3e98
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
11 changes: 6 additions & 5 deletions app.js
Expand Up @@ -39,11 +39,12 @@ app.use((err, req, res) => {
res.render("error");
});

db.sequelize.sync({ force: false });
db.sequelize.sync({ force: false }).then(()=>{
app.listen(port, () => {
// eslint-disable-next-line no-console
console.log(`Servidor funcionando en el puerto ${port}`);
});
})

app.listen(port, () => {
// eslint-disable-next-line no-console
console.log(`Servidor funcionando en el puerto ${port}`);
});

module.exports = app;
17 changes: 16 additions & 1 deletion config/config.js
@@ -1,14 +1,15 @@
require("dotenv").config();

module.exports = {
SECRET: "AlkemyBank",
development: {
username: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
host: process.env.DB_HOST,
port: process.env.DB_PORT,
dialect: "mysql",
logging: false, // set to console.log to see the raw SQL queries
native: false, // lets Sequelize know we can use pg-native for ~30% more speed
},

production: {
Expand All @@ -18,5 +19,19 @@ module.exports = {
host: process.env.DB_HOST,
port: process.env.DB_PORT,
dialect: "mysql",
pool: {
max: 3,
min: 1,
idle: 10000,
},
dialectOptions: {
ssl: {
require: true,
// Ref.: https://github.com/brianc/node-postgres/issues/2009
rejectUnauthorized: false,
},
keepAlive: true,
},
ssl: true,
},
};

0 comments on commit 8de3e98

Please sign in to comment.