소스 검색

Updated dbConfig.js file to separate logic from email engine

rota3015 5 달 전
부모
커밋
e08aeee91b
1개의 변경된 파일6개의 추가작업 그리고 26개의 파일을 삭제
  1. 6 26
      config/dbConfig.js

+ 6 - 26
config/dbConfig.js

@@ -1,37 +1,17 @@
 // dbConfig.js
 const mysql = require('mysql');
-const nodemailer = require('nodemailer');
-
-const transporter = nodemailer.createTransport({
-  host: process.env.CLOUDRON_MAIL_SMTP_SERVER, // Replace with your email server host
-  port: process.env.CLOUDRON_MAIL_SMTP_PORT, // Replace with your email server port
-  secure: false, // false for non-SSL, true for SSL/TLS
-  auth: {
-    user: process.env.CLOUDRON_MAIL_SMTP_USERNAME, // Replace with your email username
-    pass: process.env.CLOUDRON_MAIL_SMTP_PASSWORD // Replace with your email password
-  },
-});
 
 const connection = mysql.createConnection({
-  host: 'localhost',
-  user: 'root',
-  password: 'your_new_password1!Q',
-  database: 'community_rule',
+  host: process.env.CLOUDRON_MYSQL_HOST,
+  user: process.env.CLOUDRON_MYSQL_USERNAME,
+  port: process.env.CLOUDRON_MYSQL_PORT,
+  password: process.env.CLOUDRON_MYSQL_PASSWORD,
+  database: process.env.CLOUDRON_MYSQL_DATABASE,
 });
 
-// const mysql = require('mysql2');
-
-// const connection = mysql.createConnection({
-//   host: 'localhost',
-//   user: 'root',
-//   password: 'your_mysql_password',
-//   database: 'your_database_name',
-// });
-
 connection.connect((err) => {
   if (err) throw err;
   console.log('Connected to the database');
 });
 
-module.exports = connection, transporter;
-
+module.exports = connection;