Skip to content

Commit

Permalink
fix: naming
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
  • Loading branch information
thschue committed Apr 13, 2023
1 parent 9157d4d commit 159b385
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cmd/serve/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package serve
import (
"fmt"
"github.com/fatih/color"
server2 "github.com/k8sgpt-ai/k8sgpt/pkg/server"
k8sgptserver "github.com/k8sgpt-ai/k8sgpt/pkg/server"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"os"
Expand Down Expand Up @@ -38,7 +38,7 @@ var ServeCmd = &cobra.Command{
os.Exit(1)
}

server := server2.K8sGPTServer{
server := k8sgptserver.Config{
Backend: backend,
Port: port,
Token: token,
Expand Down
6 changes: 3 additions & 3 deletions pkg/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"os"
)

type K8sGPTServer struct {
type Config struct {
Port string
Backend string
Key string
Expand All @@ -20,7 +20,7 @@ type Result struct {
Analysis []analysis.Analysis `json:"analysis"`
}

func (s *K8sGPTServer) analyzeHandler(w http.ResponseWriter, r *http.Request) {
func (s *Config) analyzeHandler(w http.ResponseWriter, r *http.Request) {
namespace := r.URL.Query().Get("namespace")
explain := getBoolParam(r.URL.Query().Get("explain"))
anonymize := getBoolParam(r.URL.Query().Get("anonymize"))
Expand Down Expand Up @@ -55,7 +55,7 @@ func (s *K8sGPTServer) analyzeHandler(w http.ResponseWriter, r *http.Request) {

}

func (s *K8sGPTServer) Serve() error {
func (s *Config) Serve() error {
http.HandleFunc("/analyze", s.analyzeHandler)
color.Green("Starting server on port " + s.Port)
err := http.ListenAndServe(":"+s.Port, nil)
Expand Down

0 comments on commit 159b385

Please sign in to comment.