Skip to content

Commit

Permalink
fix: update the kubeconfig
Browse files Browse the repository at this point in the history
Signed-off-by: saltbo <saltbo@foxmail.com>
  • Loading branch information
saltbo committed Nov 13, 2022
1 parent 146b7aa commit fbf2759
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 2 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ func initConfig() {
// viper.SetConfigName(".kiae")
}

viper.AutomaticEnv() // read in environment variables that match

// If a config file is found, read it in.
if err := viper.ReadInConfig(); err == nil {
fmt.Fprintln(os.Stderr, "Using config file:", viper.ConfigFileUsed())
Expand Down
5 changes: 1 addition & 4 deletions cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ THE SOFTWARE.
package cmd

import (
"os"
"path/filepath"

"github.com/kiaedev/kiae/internal/app/server"
"github.com/spf13/cobra"
"github.com/spf13/viper"
Expand Down Expand Up @@ -54,7 +51,7 @@ func init() {
rootCmd.AddCommand(serverCmd)

serverCmd.Flags().Bool("debug", false, "specify the debug")
serverCmd.Flags().String("kubeconfig", filepath.Join(os.Getenv("HOME"), ".kube/config"), "specify kubeconfig of the kubernetes cluster")
serverCmd.Flags().String("kubeconfig", "", "specify kubeconfig of the kubernetes cluster")

_ = viper.BindPFlag("debug", serverCmd.Flags().Lookup("debug"))
_ = viper.BindPFlag("kubeconfig", serverCmd.Flags().Lookup("kubeconfig"))
Expand Down

0 comments on commit fbf2759

Please sign in to comment.