Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: TIUP_HOME is not loaded on initializes meta #1885

Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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