Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Temporarily disable server mode. #987

Merged
merged 1 commit into from
Dec 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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