1
0
mirror of https://github.com/docker/docker-credential-helpers.git synced 2026-06-13 16:01:28 +05:30

pass: fix interpolation of $PASSWORD_STORE_DIR

commit a13ff50017 simplified the handling of
env-vars in getPassDir(), but moved interpolation of env-vars to the end
of the function.

As a result, a custom path passed through `$PASSWORD_STORE_DIR` would now
be interpolated, instead of taken as-is. For example;

    PASSWORD_STORE_DIR=$PWD/world

Would now interpolate `$PWD`, instead of using a literal `$PWD`.

This patch changes the logic to only expand env-vars for the default location.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2023-05-28 18:42:06 +02:00
parent 2860ca4b4d
commit c8c415f9f7
+3 -4
View File
@@ -104,11 +104,10 @@ func (p Pass) Delete(serverURL string) error {
}
func getPassDir() string {
passDir := "$HOME/.password-store"
if envDir := os.Getenv("PASSWORD_STORE_DIR"); envDir != "" {
passDir = envDir
if passDir := os.Getenv("PASSWORD_STORE_DIR"); passDir != "" {
return passDir
}
return os.ExpandEnv(passDir)
return os.ExpandEnv("$HOME/.password-store")
}
// listPassDir lists all the contents of a directory in the password store.