mirror of
https://github.com/docker/docker-credential-helpers.git
synced 2026-06-13 16:01:28 +05:30
pass: make home-dir resolution platform agnostic
Use stdlib's os.UserHomeDir() instead of depending only on $HOME. Note that this does not yet does nss lookups for situations where $HOME / $USERPROFILE is not set. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
+3
-1
@@ -13,6 +13,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
"path"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
@@ -107,7 +108,8 @@ func getPassDir() string {
|
|||||||
if passDir := os.Getenv("PASSWORD_STORE_DIR"); passDir != "" {
|
if passDir := os.Getenv("PASSWORD_STORE_DIR"); passDir != "" {
|
||||||
return passDir
|
return passDir
|
||||||
}
|
}
|
||||||
return os.ExpandEnv("$HOME/.password-store")
|
home, _ := os.UserHomeDir()
|
||||||
|
return filepath.Join(home, ".password-store")
|
||||||
}
|
}
|
||||||
|
|
||||||
// listPassDir lists all the contents of a directory in the password store.
|
// listPassDir lists all the contents of a directory in the password store.
|
||||||
|
|||||||
Reference in New Issue
Block a user