Skip to content

Commit c740b99

Browse files
authored
Merge pull request docker#287 from thaJeztah/pass_no_interpolate
pass: fix interpolation of $PASSWORD_STORE_DIR, and use os.UserHomeDir()
2 parents a652f8e + 372315b commit c740b99

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pass/pass.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"os"
1414
"os/exec"
1515
"path"
16+
"path/filepath"
1617
"strings"
1718
"sync"
1819

@@ -104,11 +105,11 @@ func (p Pass) Delete(serverURL string) error {
104105
}
105106

106107
func getPassDir() string {
107-
passDir := "$HOME/.password-store"
108-
if envDir := os.Getenv("PASSWORD_STORE_DIR"); envDir != "" {
109-
passDir = envDir
108+
if passDir := os.Getenv("PASSWORD_STORE_DIR"); passDir != "" {
109+
return passDir
110110
}
111-
return os.ExpandEnv(passDir)
111+
home, _ := os.UserHomeDir()
112+
return filepath.Join(home, ".password-store")
112113
}
113114

114115
// listPassDir lists all the contents of a directory in the password store.

0 commit comments

Comments
 (0)