refactor: remove temp kubeconfig before daemon quit

This commit is contained in:
naison
2025-05-12 07:45:55 +00:00
parent 3791f48737
commit 46aebef01f

View File

@@ -10,6 +10,8 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"time" "time"
"github.com/wencaiwulue/kubevpn/v2/pkg/config"
) )
func DownloadFileWithName(uri, name string) (string, error) { func DownloadFileWithName(uri, name string) (string, error) {
@@ -120,7 +122,7 @@ func ParseDirMapping(dir string) (local, remote string, err error) {
} }
func CleanupTempKubeConfigFile() error { func CleanupTempKubeConfigFile() error {
return filepath.Walk(os.TempDir(), func(path string, info fs.FileInfo, err error) error { return filepath.Walk(config.GetTempPath(), func(path string, info fs.FileInfo, err error) error {
if strings.HasSuffix(path, ".kubeconfig") { if strings.HasSuffix(path, ".kubeconfig") {
return os.Remove(path) return os.Remove(path)
} }