Skip to content

Commit

Permalink
Allow per user based kubelogin lock file
Browse files Browse the repository at this point in the history
  • Loading branch information
tommylogik committed Mar 17, 2023
1 parent 4df4f41 commit 9f118af
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/infrastructure/mutex/mutex.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ func internalRelease(fm *filemutex.FileMutex, lfn string, log logger.Interface)

// LockFileName get the lock file name from the lock name.
func LockFileName(name string) string {
return path.Join(os.TempDir(), fmt.Sprintf(".kubelogin.%s.lock", name))
dirname, err := os.UserHomeDir()
if err != nil {
dirname = os.TempDir()
}
return path.Join(dirname, fmt.Sprintf(".kubelogin.%s.lock", name))
}

// Acquire acquire a lock for the specified name. The context could be used to set a timeout.
Expand Down

0 comments on commit 9f118af

Please sign in to comment.