mirror of
https://github.com/kubenetworks/kubevpn.git
synced 2025-09-27 03:36:09 +08:00
refactor: remove temp kubeconfig before daemon quit
This commit is contained in:
@@ -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)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user