config: revert to using pkg/homedir

In c2626a82 homedir logic got extremely simplified to only
checking HOME environment variable on UNIX systems.

Although this should work well enough in traditional environments,
this could break minimal containerized environments.

This patch reverts to using github.com/docker/docker/pkg/homedir
that was recently updated to have less dependencies.

Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Tibor Vass 2019-09-26 22:12:24 +00:00
parent 3e07fa728a
commit 7a279af43d
1 changed files with 2 additions and 4 deletions

View File

@ -10,6 +10,7 @@ import (
"github.com/docker/cli/cli/config/configfile"
"github.com/docker/cli/cli/config/credentials"
"github.com/docker/cli/cli/config/types"
"github.com/docker/docker/pkg/homedir"
"github.com/pkg/errors"
)
@ -27,10 +28,7 @@ var (
func init() {
if configDir == "" {
homedir, err := os.UserHomeDir()
if err == nil {
configDir = filepath.Join(homedir, configFileDir)
}
configDir = filepath.Join(homedir.Get(), configFileDir)
}
}