Skip to content

Commit

Permalink
use PASSWORD_STORE_DIR if set
Browse files Browse the repository at this point in the history
  • Loading branch information
merrickluo committed Mar 4, 2022
1 parent 7098185 commit e99e39c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pass.go
Expand Up @@ -24,7 +24,11 @@ func init() {
pass.passcmd = "pass"
}
if cfg.PassDir == "" {
pass.dir = filepath.Join(os.Getenv("HOME"), ".password-store")
if passDir, found := os.LookupEnv("PASSWORD_STORE_DIR"); found {
pass.dir = passDir
} else {
pass.dir = filepath.Join(os.Getenv("HOME"), ".password-store")
}
} else if strings.HasPrefix(pass.dir, "~") {
if len(pass.dir) > 1 && pass.dir[1] != '/' {
return nil, fmt.Errorf("Cannot expand path: %s", pass.dir)
Expand Down

0 comments on commit e99e39c

Please sign in to comment.