|
@@ -1,16 +1,8 @@
|
|
|
const mysql = require('mysql')
|
|
|
-const db_config = {
|
|
|
- // host: '74.10.28.37',
|
|
|
- // user: 'ax_tj_seat',
|
|
|
- // password: 'Taiji@2023#seat',
|
|
|
- // port: "45371",
|
|
|
- // database: 'seat_tools'
|
|
|
- host: '8.140.240.182',
|
|
|
- user: 'root',
|
|
|
- password: 'Taiji@2023#data',
|
|
|
- port: "18080",
|
|
|
- database: 'seat_tools'
|
|
|
-}
|
|
|
+const fs = require("fs");
|
|
|
+const configFile = fs.readFileSync('./config.json');
|
|
|
+const globalConfig = JSON.parse(configFile)
|
|
|
+const db_config = globalConfig['ship-test'].db
|
|
|
// 进行数据库交互
|
|
|
const sqlHandle = (sql, values) => {
|
|
|
let connect = mysql.createConnection(db_config)
|