nacos config

This commit is contained in:
eson 2023-09-22 11:45:56 +08:00
parent 2d224c0d67
commit 11cee190b0
2 changed files with 50 additions and 32 deletions

View File

@ -115,6 +115,7 @@ func main() {
// } // }
// } // }
proxy.ServeHTTP(w, r) proxy.ServeHTTP(w, r)
log.Println(w.Header())
return return
} else { } else {

View File

@ -4,6 +4,26 @@ single_server_name=$1
go mod tidy go mod tidy
go mod vendor go mod vendor
find /tmp/go-build* -mmin +5 -exec rm -rf {} +
find /tmp/go-link* -mmin +5 -exec rm -rf {} +
run_proxyserver() {
# 定义目录和screen名称
dir_path="./proxyserver"
screen_name="proxyserver"
# 进入目录
cd $dir_path
# 检查是否存在screen session
if screen -list | grep -q "$screen_name"; then
# 结束存在的screen session
screen -S $screen_name -X quit
fi
go build
# 启动新的screen session并运行go程序
echo "run $screen_name"
screen -dmS $screen_name -L ./$screen_name
}
# 定义一个函数来在每个服务器目录下运行 go run <server_name>.go # 定义一个函数来在每个服务器目录下运行 go run <server_name>.go
run_server() { run_server() {
@ -38,43 +58,40 @@ run_server() {
cd - > /dev/null cd - > /dev/null
} }
find /tmp/go-build* -mmin +5 -exec rm -rf {} + if [ "$single_server_name" = "proxyserver" ]; then
find /tmp/go-link* -mmin +5 -exec rm -rf {} + # 重启proxyserver的逻辑
run_proxyserver
else
server_dirs=() # 初始化一个空数组 server_dirs=() # 初始化一个空数组
if [ -n "$single_server_name" ]; then if [ -n "$single_server_name" ]; then
server_dirs=("$single_server_name") server_dirs=("$single_server_name")
else else
for dir in server/*/ ; do # 遍历 "server/" 下的所有子目录 for dir in server/*/ ; do # 遍历 "server/" 下的所有子目录
dir=${dir%*/} # 删除末尾的 "/" dir=${dir%*/} # 删除末尾的 "/"
dir=${dir##*/} # 删除开头的 "server/" dir=${dir##*/} # 删除开头的 "server/"
server_dirs+=("$dir") # 添加到数组 server_dirs+=("$dir") # 添加到数组
done done
fi
# 在每个服务器目录下运行相应的 go 程序
for server_dir in "${server_dirs[@]}"; do
run_server $server_dir
done
if [ -n "$single_server_name" ]; then
echo "no proxyserver restart"
else
run_proxyserver
fi
fi fi
# 在每个服务器目录下运行相应的 go 程序
for server_dir in "${server_dirs[@]}"; do
run_server $server_dir
done
if [ -n "$single_server_name" ]; then
echo "no proxyserver restart"
else
# 定义目录和screen名称
dir_path="./proxyserver"
screen_name="proxyserver"
# 进入目录
cd $dir_path
# 检查是否存在screen session
if screen -list | grep -q "$screen_name"; then
# 结束存在的screen session
screen -S $screen_name -X quit
fi
go build
# 启动新的screen session并运行go程序
screen -dmS $screen_name -L ./$screen_name
fi