Skip to content

Commit 6bc73c3

Browse files
xcasparMandssS
authored andcommitted
fix: Temporarily disable server mode.
Signed-off-by: xcaspar <changjun.xcj@alibaba-inc.com>
1 parent 0a07380 commit 6bc73c3

File tree

2 files changed

+3
-21
lines changed

2 files changed

+3
-21
lines changed

cli/cmd/cmd.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,7 @@ func CmdInit() *baseCommand {
5555
queryCommand.AddCommand(&QueryJvmCommand{})
5656
queryCommand.AddCommand(&QueryK8sCommand{})
5757

58-
// add server command
59-
serverCommand := &ServerCommand{}
60-
baseCmd.AddCommand(serverCommand)
61-
serverCommand.AddCommand(&StartServerCommand{})
62-
serverCommand.AddCommand(&StopServerCommand{})
63-
serverCommand.AddCommand(&StatusServerCommand{})
58+
// UPDATE 2023-12-30 Disable server command mode.
6459

6560
// add check command
6661
checkCommand := &CheckCommand{}

cli/cmd/server_start.go

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func (ssc *StartServerCommand) start0() {
123123
go func() {
124124
err := http.ListenAndServe(ssc.ip+":"+ssc.port, nil)
125125
if err != nil {
126-
log.Errorf(context.Background(),"start blade server error, %v", err)
126+
log.Errorf(context.Background(), "start blade server error, %v", err)
127127
//log.Error(err, "start blade server error")
128128
os.Exit(1)
129129
}
@@ -134,20 +134,7 @@ func (ssc *StartServerCommand) start0() {
134134

135135
func Register(requestPath string) {
136136
http.HandleFunc(requestPath, func(writer http.ResponseWriter, request *http.Request) {
137-
err := request.ParseForm()
138-
if err != nil {
139-
fmt.Fprintf(writer, spec.ReturnFail(spec.ParameterRequestFailed, err.Error()).Print())
140-
return
141-
}
142-
cmds := request.Form["cmd"]
143-
if len(cmds) != 1 {
144-
fmt.Fprintf(writer, spec.ResponseFailWithFlags(spec.ParameterLess, "cmd").Print())
145-
return
146-
}
147-
ctx := context.WithValue(context.Background(), "mode", "server")
148-
response := channel.NewLocalChannel().Run(ctx, path.Join(util.GetProgramPath(), "blade"), cmds[0])
149-
log.Debugf(ctx, "Server response: %v", response)
150-
fmt.Fprintf(writer, response.Print())
137+
fmt.Fprintf(writer, spec.ReturnFail(spec.CommandIllegal, "Server mode is disabled").Print())
151138
})
152139
}
153140

0 commit comments

Comments
 (0)