Skip to content

Commit

Permalink
fix: Temporarily disable server mode.
Browse files Browse the repository at this point in the history
Signed-off-by: xcaspar <changjun.xcj@alibaba-inc.com>
  • Loading branch information
xcaspar authored and MandssS committed Dec 31, 2023
1 parent 0a07380 commit 6bc73c3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
7 changes: 1 addition & 6 deletions cli/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,7 @@ func CmdInit() *baseCommand {
queryCommand.AddCommand(&QueryJvmCommand{})
queryCommand.AddCommand(&QueryK8sCommand{})

// add server command
serverCommand := &ServerCommand{}
baseCmd.AddCommand(serverCommand)
serverCommand.AddCommand(&StartServerCommand{})
serverCommand.AddCommand(&StopServerCommand{})
serverCommand.AddCommand(&StatusServerCommand{})
// UPDATE 2023-12-30 Disable server command mode.

// add check command
checkCommand := &CheckCommand{}
Expand Down
17 changes: 2 additions & 15 deletions cli/cmd/server_start.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (ssc *StartServerCommand) start0() {
go func() {
err := http.ListenAndServe(ssc.ip+":"+ssc.port, nil)
if err != nil {
log.Errorf(context.Background(),"start blade server error, %v", err)
log.Errorf(context.Background(), "start blade server error, %v", err)
//log.Error(err, "start blade server error")
os.Exit(1)
}
Expand All @@ -134,20 +134,7 @@ func (ssc *StartServerCommand) start0() {

func Register(requestPath string) {
http.HandleFunc(requestPath, func(writer http.ResponseWriter, request *http.Request) {
err := request.ParseForm()
if err != nil {
fmt.Fprintf(writer, spec.ReturnFail(spec.ParameterRequestFailed, err.Error()).Print())
return
}
cmds := request.Form["cmd"]
if len(cmds) != 1 {
fmt.Fprintf(writer, spec.ResponseFailWithFlags(spec.ParameterLess, "cmd").Print())
return
}
ctx := context.WithValue(context.Background(), "mode", "server")
response := channel.NewLocalChannel().Run(ctx, path.Join(util.GetProgramPath(), "blade"), cmds[0])
log.Debugf(ctx, "Server response: %v", response)
fmt.Fprintf(writer, response.Print())
fmt.Fprintf(writer, spec.ReturnFail(spec.CommandIllegal, "Server mode is disabled").Print())
})
}

Expand Down

1 comment on commit 6bc73c3

@boxker
Copy link

@boxker boxker commented on 6bc73c3 May 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, I would like to know why the server mode is temporarily disabled?

Please sign in to comment.