From d8b43a7f834c2f0de15d8abaaae6abaf713d406c Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Mon, 10 Jul 2023 13:07:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E6=89=80=E6=9C=89?= =?UTF-8?q?=E7=AB=AF=E5=8F=A3=20=E4=B8=8D=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- change_port.sh | 29 +++++++++++++++++++ server/backend/etc/backend.yaml | 2 +- server/canteen/etc/canteen.yaml | 2 +- server/data-transfer/etc/data-transfer.yaml | 2 +- server/home-user-auth/etc/home-user-auth.yaml | 2 +- server/inventory/etc/inventory.yaml | 2 +- server/map-library/etc/map-library.yaml | 2 +- server/orders/etc/orders.yaml | 2 +- server/product-model/etc/product-model.yaml | 2 +- .../etc/product-template.yaml | 2 +- server/product/etc/product.yaml | 2 +- .../etc/shopping-cart-confirmation.yaml | 2 +- server/upload/etc/upload.yaml | 2 +- 13 files changed, 41 insertions(+), 12 deletions(-) create mode 100644 change_port.sh diff --git a/change_port.sh b/change_port.sh new file mode 100644 index 00000000..afe3c3b2 --- /dev/null +++ b/change_port.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# 定义一个函数来修改每个服务器的配置文件中的端口 +change_port() { + server_name=$1 + port=$2 + config_file="server/${server_name}/etc/${server_name}.yaml" + + echo "Changing port for $server_name to $port" + + if [ -f "$config_file" ]; then + # 使用 sed 将 Port 替换为新的端口 + sed -i "s/^Port: .*$/Port: $port/" "$config_file" + else + echo "Configuration file $config_file not found" + fi +} + +# 列出所有服务器目录 +server_dirs=("backend" "canteen" "data-transfer" "home-user-auth" "inventory" "map-library" "orders" "product" "product-model" "product-template" "shopping-cart-confirmation" "upload" "webset") + +# 初始化端口为 9901 +port=9901 + +# 遍历服务器目录,修改每个服务器的配置文件中的端口 +for server_dir in "${server_dirs[@]}"; do + change_port $server_dir $port + port=$((port + 1)) +done diff --git a/server/backend/etc/backend.yaml b/server/backend/etc/backend.yaml index 4eaa9a8d..f21404d1 100644 --- a/server/backend/etc/backend.yaml +++ b/server/backend/etc/backend.yaml @@ -1,6 +1,6 @@ Name: backend Host: 0.0.0.0 -Port: 8888 +Port: 9901 SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest Auth: AccessSecret: fusen_backend_2023 diff --git a/server/canteen/etc/canteen.yaml b/server/canteen/etc/canteen.yaml index b8ce24d8..46f400c5 100644 --- a/server/canteen/etc/canteen.yaml +++ b/server/canteen/etc/canteen.yaml @@ -1,6 +1,6 @@ Name: canteen Host: 0.0.0.0 -Port: 8891 +Port: 9902 SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest Auth: AccessSecret: fusen2023 diff --git a/server/data-transfer/etc/data-transfer.yaml b/server/data-transfer/etc/data-transfer.yaml index 4a2111b7..250dac2d 100644 --- a/server/data-transfer/etc/data-transfer.yaml +++ b/server/data-transfer/etc/data-transfer.yaml @@ -1,6 +1,6 @@ Name: data-transfer Host: 0.0.0.0 -Port: 8890 +Port: 9903 SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest Auth: AccessSecret: fusen2023 diff --git a/server/home-user-auth/etc/home-user-auth.yaml b/server/home-user-auth/etc/home-user-auth.yaml index 2248d039..f9b0f58d 100644 --- a/server/home-user-auth/etc/home-user-auth.yaml +++ b/server/home-user-auth/etc/home-user-auth.yaml @@ -1,6 +1,6 @@ Name: home-user-auth Host: 0.0.0.0 -Port: 9901 +Port: 9904 SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest Auth: diff --git a/server/inventory/etc/inventory.yaml b/server/inventory/etc/inventory.yaml index 611a0d7e..9296a16b 100644 --- a/server/inventory/etc/inventory.yaml +++ b/server/inventory/etc/inventory.yaml @@ -1,6 +1,6 @@ Name: inventory Host: 0.0.0.0 -Port: 8898 +Port: 9905 SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest Auth: AccessSecret: fusen2023 diff --git a/server/map-library/etc/map-library.yaml b/server/map-library/etc/map-library.yaml index 1d2ac64b..a4d07e04 100644 --- a/server/map-library/etc/map-library.yaml +++ b/server/map-library/etc/map-library.yaml @@ -1,6 +1,6 @@ Name: map-library Host: 0.0.0.0 -Port: 8893 +Port: 9906 SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest Auth: AccessSecret: fusen2023 diff --git a/server/orders/etc/orders.yaml b/server/orders/etc/orders.yaml index 924f35e1..26aa6561 100644 --- a/server/orders/etc/orders.yaml +++ b/server/orders/etc/orders.yaml @@ -1,6 +1,6 @@ Name: orders Host: 0.0.0.0 -Port: 8893 +Port: 9907 SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest Auth: AccessSecret: fusen2023 diff --git a/server/product-model/etc/product-model.yaml b/server/product-model/etc/product-model.yaml index ebf5393c..adce80ef 100644 --- a/server/product-model/etc/product-model.yaml +++ b/server/product-model/etc/product-model.yaml @@ -1,6 +1,6 @@ Name: product-model Host: 0.0.0.0 -Port: 8897 +Port: 9909 SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest Auth: AccessSecret: fusen2023 diff --git a/server/product-template/etc/product-template.yaml b/server/product-template/etc/product-template.yaml index a5a69f1c..8991920d 100644 --- a/server/product-template/etc/product-template.yaml +++ b/server/product-template/etc/product-template.yaml @@ -1,6 +1,6 @@ Name: product-template Host: 0.0.0.0 -Port: 8896 +Port: 9910 SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest Auth: AccessSecret: fusen2023 diff --git a/server/product/etc/product.yaml b/server/product/etc/product.yaml index 05ddc7de..1a3ce1fe 100644 --- a/server/product/etc/product.yaml +++ b/server/product/etc/product.yaml @@ -1,6 +1,6 @@ Name: product Host: 0.0.0.0 -Port: 9902 +Port: 9908 SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest Auth: AccessSecret: fusen2023 diff --git a/server/shopping-cart-confirmation/etc/shopping-cart-confirmation.yaml b/server/shopping-cart-confirmation/etc/shopping-cart-confirmation.yaml index be590b34..26610567 100644 --- a/server/shopping-cart-confirmation/etc/shopping-cart-confirmation.yaml +++ b/server/shopping-cart-confirmation/etc/shopping-cart-confirmation.yaml @@ -1,6 +1,6 @@ Name: shopping-cart-confirmation Host: 0.0.0.0 -Port: 9902 +Port: 9911 SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest Auth: AccessSecret: fusen2023 diff --git a/server/upload/etc/upload.yaml b/server/upload/etc/upload.yaml index c5ecd657..6ccd1c84 100644 --- a/server/upload/etc/upload.yaml +++ b/server/upload/etc/upload.yaml @@ -1,6 +1,6 @@ Name: upload Host: 0.0.0.0 -Port: 9903 +Port: 9912 SourceMysql: "fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest" Env: "test" Auth: