From e99e39c126c17fab05ae1800cba547253b0eb821 Mon Sep 17 00:00:00 2001 From: "A.I" Date: Fri, 4 Mar 2022 13:42:30 +0800 Subject: [PATCH] use PASSWORD_STORE_DIR if set --- pass.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pass.go b/pass.go index 24662ab..8ab252e 100644 --- a/pass.go +++ b/pass.go @@ -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)