Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop
This commit is contained in:
commit
2a849dde38
|
@ -18,7 +18,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gopkg.in/yaml.v2"
|
||||
|
||||
_ "fusenapi/utils/auth"
|
||||
|
@ -105,15 +104,16 @@ func main() {
|
|||
|
||||
// 对/api开头的请求进行反向代理
|
||||
proxy := httputil.NewSingleHostReverseProxy(apiURL)
|
||||
proxy.ErrorHandler = func(res http.ResponseWriter, req *http.Request, err error) {
|
||||
if err != nil {
|
||||
// proxy.ErrorHandler = func(res http.ResponseWriter, req *http.Request, err error) {
|
||||
// if err != nil {
|
||||
|
||||
// 在发生错误时进行处理
|
||||
logx.Error(err)
|
||||
logx.Error(res.Header())
|
||||
res.WriteHeader(http.StatusNotFound) // 返回404状态码
|
||||
}
|
||||
}
|
||||
// // 在发生错误时进行处理
|
||||
// log.Println(res.Header())
|
||||
// logx.Info(err)
|
||||
// logx.Info(res.Header())
|
||||
// res.WriteHeader(http.StatusNotFound) // 返回404状态码
|
||||
// }
|
||||
// }
|
||||
proxy.ServeHTTP(w, r)
|
||||
return
|
||||
|
||||
|
|
|
@ -8,22 +8,30 @@ go mod vendor
|
|||
# 定义一个函数来在每个服务器目录下运行 go run <server_name>.go
|
||||
run_server() {
|
||||
server_name=$1
|
||||
echo "Running $server_name"
|
||||
|
||||
|
||||
|
||||
# 导航到相应的目录
|
||||
cd server/$server_name
|
||||
go build
|
||||
echo "build $server_name"
|
||||
|
||||
# 如果之前存在相同名字的 screen 会话,先将其终止
|
||||
# 首先尝试关闭已存在的screen会话
|
||||
existing_session=$(screen -ls | grep -w "$server_name")
|
||||
if [ -n "$existing_session" ]; then
|
||||
echo "Terminating existing screen session for $server_name"
|
||||
screen -S "$server_name" -X quit
|
||||
while [[ $(screen -ls | grep "\.$server_name\s") ]]; do
|
||||
sleep 0.1s # 等待0.1秒后再次检查
|
||||
echo "wait for $server_name"
|
||||
done
|
||||
fi
|
||||
# 导航到相应的目录
|
||||
cd server/$server_name
|
||||
go build
|
||||
|
||||
# 循环检查screen进程是否存在
|
||||
|
||||
[ -f .gitignore ] || echo $server_name > .gitignore
|
||||
# 使用 screen 运行 go run <server_name>.go
|
||||
|
||||
echo "Running $server_name"
|
||||
screen -dmS $server_name -L ./$server_name
|
||||
|
||||
# 返回到上一级目录
|
||||
|
|
Loading…
Reference in New Issue
Block a user