fix: naming

Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
This commit is contained in:
Thomas Schuetz 2023-04-13 09:00:14 +02:00
parent 9157d4dd13
commit 159b3851ec
No known key found for this signature in database
GPG Key ID: 2F8BF0EDDAA5778F
2 changed files with 5 additions and 5 deletions

View File

@ -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"
@ -38,7 +38,7 @@ var ServeCmd = &cobra.Command{
os.Exit(1)
}
server := server2.K8sGPTServer{
server := k8sgptserver.Config{
Backend: backend,
Port: port,
Token: token,

View File

@ -8,7 +8,7 @@ import (
"os"
)
type K8sGPTServer struct {
type Config struct {
Port string
Backend string
Key string
@ -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"))
@ -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)