Skip to content

Commit

Permalink
feat:add vlogs server
Browse files Browse the repository at this point in the history
  • Loading branch information
bearslyricattack committed Jan 10, 2025
1 parent 7c073e2 commit 1f9161d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions service/vlogs/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/labring/sealos/service/pkg/auth"
"log"
"net/http"
"net/url"
Expand Down Expand Up @@ -40,20 +41,19 @@ func (vl *VLogsServer) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
}

func (vl *VLogsServer) queryLogsByParams(rw http.ResponseWriter, req *http.Request) {
//kubeConfig, namespace, query, err := vl.generateParamsRequest(req)
_, _, query, err := vl.generateParamsRequest(req)
kubeConfig, namespace, query, err := vl.generateParamsRequest(req)
if err != nil {
http.Error(rw, fmt.Sprintf("Bad request (%s)", err), http.StatusBadRequest)
log.Printf("Bad request (%s)\n", err)
return
}

//err = auth.Authenticate(namespace, kubeConfig)
//if err != nil {
// http.Error(rw, fmt.Sprintf("Authentication failed (%s)", err), http.StatusInternalServerError)
// log.Printf("Authentication failed (%s)\n", err)
// return
//}
err = auth.Authenticate(namespace, kubeConfig)
if err != nil {
http.Error(rw, fmt.Sprintf("Authentication failed (%s)", err), http.StatusInternalServerError)
log.Printf("Authentication failed (%s)\n", err)
return
}

fmt.Println("query: " + query)
err = request.QueryLogsByParams(vl.path, vl.username, vl.password, query, rw)
Expand Down

0 comments on commit 1f9161d

Please sign in to comment.