Skip to content

Commit

Permalink
* Fix bugs
Browse files Browse the repository at this point in the history
* Remove irrelevant code
  • Loading branch information
AdachiAndShimamura authored and vyloy committed Mar 21, 2024
1 parent 444686f commit 8f30789
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
27 changes: 10 additions & 17 deletions libcs/client/web/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import (
"github.com/isrc-cas/gt/web/server/model/request"
"github.com/isrc-cas/gt/web/server/model/response"
"github.com/isrc-cas/gt/web/server/util"
"os"
"os/exec"
)

func HealthCheck(ctx *gin.Context) {
Expand Down Expand Up @@ -183,24 +181,10 @@ func SaveConfigToFile(c *client.Client) gin.HandlerFunc {
}
c.Logger.Info().Str("config", fullPath).Msg("save config to file")

err = ReloadServicesCommand(c)
if err != nil {
response.FailWithMessage(err.Error(), ctx)
return
}
Reload(ctx)
response.SuccessWithMessage("save config to "+fullPath, ctx)
}
}
func ReloadServicesCommand(c *client.Client) (err error) {
execPath := os.Args[0]
command := exec.Command(execPath, "-s", "reload")
_, err = command.CombinedOutput()
if err != nil {
c.Logger.Logger.Info().Msg("failed to exec command-reload:" + err.Error())
return
}
return
}

// Restart for a brand-new config process,
// not only reload the services,
Expand All @@ -214,6 +198,15 @@ func Restart(ctx *gin.Context) {
response.Success(ctx)
}

func Reload(ctx *gin.Context) {
err := util.SendSignal("reload")
if err != nil {
response.FailWithMessage(err.Error(), ctx)
return
}
response.Success(ctx)
}

func Stop(ctx *gin.Context) {
err := util.SendSignal("stop")
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions libcs/web/front/src/languages/lang/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export namespace zh {
Local: "本地服务的 URL",
LocalURL: "本地服务的 URL",
LocalTimeout: "本地连接的超时时间。支持值如 '30s'、'5m'",
UseLocalAsHTTPHost: "使用本地主机作为GT-Server主机",
UseLocalAsHTTPHost: "使用本地URL作为HTTP Header Host的值",

// Sentry 设置
SentryDSN: "要使用的 Sentry DSN",
Expand Down Expand Up @@ -238,7 +238,7 @@ export namespace zh {
RemoteTCPRandom: "GT-Server TCP随机端口",
LocalURL: "本地 URL",
LocalTimeout: "本地连接超时时间",
UseLocalAsHTTPHost: "使用本地主机运行GT-Server",
UseLocalAsHTTPHost: "HTTP Header Host替换",
TcpForwardAddr: "TCP 转发地址",
TcpForwardHostPrefix: "TCP 转发主机前缀",
TcpForwardConnections: "TCP 转发连接数",
Expand Down

0 comments on commit 8f30789

Please sign in to comment.