From 5f83281dc8fd37e4fbc8cc7a3d4a47fbfb94906e Mon Sep 17 00:00:00 2001 From: NicolaCage Date: Wed, 19 Jan 2022 13:35:09 +0800 Subject: [PATCH] mod: server config.yaml --- DEPLOY.md | 4 ++-- server/config.yaml | 6 +++++- server/server.js | 11 +++++++---- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/DEPLOY.md b/DEPLOY.md index 32ea1ebc..c8307846 100644 --- a/DEPLOY.md +++ b/DEPLOY.md @@ -76,14 +76,14 @@ Attention: the file under these packages is compiled under Linux environment, ca }, ``` -- Modify proxy setting: `./vendors/config-release.yaml` +- Modify proxy setting: `./config.yaml` ``` port: 7003 proxy: gateway: target: "127.0.0.1:8090" // change gateway service proxy prometheus: - target: "127.0.0.1:9091" // change prometheus service proxy + target: "127.0.0.1:9090" // change prometheus service proxy ``` - Start: ```bash diff --git a/server/config.yaml b/server/config.yaml index e910e7bb..e24d04e0 100644 --- a/server/config.yaml +++ b/server/config.yaml @@ -3,4 +3,8 @@ proxy: gateway: target: "http://localhost:8080" prometheus: - target: "192.168.8.157:9090" \ No newline at end of file + target: "192.168.8.157:9090" +nebulaServer: + ip: "192.168.8.145", + port: 9669 + \ No newline at end of file diff --git a/server/server.js b/server/server.js index 98ca8c26..d0438f68 100755 --- a/server/server.js +++ b/server/server.js @@ -2,7 +2,6 @@ const express = require('express'); const { createProxyMiddleware } = require('http-proxy-middleware'); const history = require('connect-history-api-fallback'); const fs = require('fs'); -const path = require('path'); const pkg = require('../package.json'); const yaml = require('js-yaml'); let config = {}; @@ -14,7 +13,7 @@ try { throw new Error(e); } -const { proxy, port = 7003 } = config; +const { proxy,nebulaServer, port = 7003 } = config; if (!proxy) { throw new Error('no proxy found in config.yaml'); @@ -57,11 +56,15 @@ app.get('/api/app', (_req, res) => { }); app.get('/api/config/custom', async (_req, res) => { - const data = await fs.readFileSync(path.join(__dirname, '../static/custom.json'), 'utf8'); if (data) { res.send({ code: 0, - data: JSON.parse(data) + data: { + connection: nebulaServer, + alias: { + "ip:port": "instance1" + }, + } }); } else { res.send({