refactor: change temp kubeconfig to ~/.kubevpn/tmp

This commit is contained in:
fengcaiwen
2025-04-29 21:39:45 +08:00
parent 9ba873494f
commit ebaa4098f1
3 changed files with 49 additions and 3 deletions

View File

@@ -21,6 +21,8 @@ const (
LogFile = "daemon.log"
ConfigFile = "config.yaml"
TmpDir = "tmp"
)
//go:embed config.yaml
@@ -51,6 +53,14 @@ func init() {
if err != nil {
panic(err)
}
err = os.MkdirAll(GetTempPath(), 0755)
if err != nil {
panic(err)
}
err = os.Chmod(GetTempPath(), 0755)
if err != nil {
panic(err)
}
path := filepath.Join(HomePath, ConfigFile)
_, err = os.Stat(path)
@@ -85,3 +95,7 @@ func GetSyncthingPath() string {
func GetConfigFilePath() string {
return filepath.Join(HomePath, ConfigFile)
}
func GetTempPath() string {
return filepath.Join(HomePath, TmpDir)
}