CzRger 1 year ago
parent
commit
df5b8057af
4 changed files with 23 additions and 10 deletions
  1. 19 7
      config.json
  2. 1 1
      run-ax-node.sh
  3. 1 1
      src/app.js
  4. 2 1
      src/ship-test/config/db.js

+ 19 - 7
config.json

@@ -1,12 +1,24 @@
 {
+  "port": 18061,
   "ship-test": {
-    "port": 3000,
-    "db": {
-      "host": "8.140.240.182",
-      "port": "18080",
-      "user": "root",
-      "password": "Taiji@2023#data",
-      "database": "seat_tools"
+    "version": "182",
+    "182": {
+      "db": {
+        "host": "8.140.240.182",
+        "port": "18080",
+        "user": "root",
+        "password": "Taiji@2023#data",
+        "database": "seat_tools"
+      }
+    },
+    "101": {
+      "db": {
+        "host": "10.112.89.101",
+        "port": "9030",
+        "user": "root",
+        "password": "ROOT@taiji2022!",
+        "database": "seat_tools"
+      }
     }
   }
 }

+ 1 - 1
run-ax-node.sh

@@ -1,2 +1,2 @@
-chmod u+x app
+chmod u+x ./app
 nohup ./app > ax-node.log 2>&1 &

+ 1 - 1
src/app.js

@@ -7,7 +7,7 @@ const fs = require('fs');
 const configFile = fs.readFileSync('./config.json');
 const globalConfig = JSON.parse(configFile)
 console.log(JSON.parse(configFile))
-const port = globalConfig['ship-test'].port
+const port = globalConfig.port
 
 // 创建 app
 const app = express()

+ 2 - 1
src/ship-test/config/db.js

@@ -2,7 +2,8 @@ const mysql = require('mysql')
 const fs = require("fs");
 const configFile = fs.readFileSync('./config.json');
 const globalConfig = JSON.parse(configFile)
-const db_config = globalConfig['ship-test'].db
+const shipTestConfig = globalConfig['ship-test'][globalConfig['ship-test']['version']]
+const db_config = shipTestConfig.db
 // 进行数据库交互
 const sqlHandle = (sql, values) => {
     let connect = mysql.createConnection(db_config)