dbConfig.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // dbConfig.js
  2. const mysql = require('mysql');
  3. const nodemailer = require('nodemailer');
  4. const transporter = nodemailer.createTransport({
  5. host: process.env.CLOUDRON_MAIL_SMTP_SERVER, // Replace with your email server host
  6. port: process.env.CLOUDRON_MAIL_SMTP_PORT, // Replace with your email server port
  7. secure: false, // false for non-SSL, true for SSL/TLS
  8. auth: {
  9. user: process.env.CLOUDRON_MAIL_SMTP_USERNAME, // Replace with your email username
  10. pass: process.env.CLOUDRON_MAIL_SMTP_PASSWORD // Replace with your email password
  11. },
  12. });
  13. const connection = mysql.createConnection({
  14. host: 'localhost',
  15. user: 'root',
  16. password: 'your_new_password1!Q',
  17. database: 'community_rule',
  18. });
  19. // const mysql = require('mysql2');
  20. // const connection = mysql.createConnection({
  21. // host: 'localhost',
  22. // user: 'root',
  23. // password: 'your_mysql_password',
  24. // database: 'your_database_name',
  25. // });
  26. connection.connect((err) => {
  27. if (err) throw err;
  28. console.log('Connected to the database');
  29. });
  30. module.exports = connection, transporter;