config: honor XDG_CONFIG_HOME

when the env variable is set, use its value for locating the user
configuration file.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2020-03-13 15:03:24 +01:00
parent 88eaa67192
commit 9322b03394
1 changed files with 3 additions and 0 deletions

View File

@ -827,6 +827,9 @@ func isDirectory(path string) error {
}
func rootlessConfigPath() (string, error) {
if configHome := os.Getenv("XDG_CONFIG_HOME"); configHome != "" {
return filepath.Join(configHome, UserOverrideContainersConfig), nil
}
home, err := unshare.HomeDir()
if err != nil {
return "", err