Skip to content

Commit

Permalink
Merge 708e2a1 into dda5c51
Browse files Browse the repository at this point in the history
  • Loading branch information
srstack authored May 23, 2022
2 parents dda5c51 + 708e2a1 commit 3840d0d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/cluster/spec/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,19 @@ var initialized = false
// The directory will be created before return if it does not already exist.
func Initialize(base string) error {
tiupData := os.Getenv(tiuplocaldata.EnvNameComponentDataDir)
if tiupData == "" {
tiupHome := os.Getenv(tiuplocaldata.EnvNameHome)

switch {
case tiupData != "":
profileDir = tiupData
case tiupHome != "":
profileDir = path.Join(tiupHome, tiuplocaldata.StorageParentDir, base)
default:
homeDir, err := getHomeDir()
if err != nil {
return errors.Trace(err)
}
profileDir = path.Join(homeDir, ".tiup", tiuplocaldata.StorageParentDir, base)
} else {
profileDir = tiupData
}

clusterBaseDir := filepath.Join(profileDir, TiUPClusterDir)
Expand Down

0 comments on commit 3840d0d

Please sign in to comment.