Skip to content

Commit

Permalink
use KUEBCOBFIG (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfrancisc authored Aug 1, 2024
1 parent 3f9f1bf commit f1ff8ef
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/cmd/adm/register_member.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ func NewRegisterMemberCmd() *cobra.Command {
}

defaultKubeConfigPath := ""
if home := homedir.HomeDir(); home != "" {

// first check if KUBECONFIG env variable is set
if kubeconfigPath := os.Getenv("KUBECONFIG"); kubeconfigPath != "" {
defaultKubeConfigPath = kubeconfigPath
} else if home := homedir.HomeDir(); home != "" {
// use home kubeconfig if no KUBECONFIG env var was set
defaultKubeConfigPath = filepath.Join(home, ".kube", "config")
}

Expand Down

0 comments on commit f1ff8ef

Please sign in to comment.