DockerCLI/cli/config
Sebastiaan van Stijn c85a37dbb4
cli/config: prevent warning if HOME is not set
commit c2626a8270 replaced the use of
github.com/docker/docker/pkg/homedir with Golang's os.UserHomeDir().

This change was partially reverted in 7a279af43d
to account for situations where `$HOME` is not set.

In  situations where no configuration file is present in `~/.config/`, the CLI
falls back to looking for the (deprecated) `~/.dockercfg` configuration file,
which was still using `os.UserHomeDir()`, which produces an error/warning if
`$HOME` is not set.

This patch introduces a helper function and a global variable to get the user's
home-directory. The global variable is used to prevent repeatedly looking up
the user's information (which, depending on the setup can be a costly operation).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-01-18 17:47:00 +01:00
..
configfile Config-file: remove User-Agent from config.json when saving 2020-10-01 15:04:39 +02:00
credentials bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-23 00:28:55 +01:00
types Remove docker api dependency from cli/config 2019-01-31 21:25:43 +00:00
config.go cli/config: prevent warning if HOME is not set 2021-01-18 17:47:00 +01:00
config_test.go cli/config: prevent warning if HOME is not set 2021-01-18 17:47:00 +01:00