diff options
Diffstat (limited to 'lib/xdsconfig/fileconfig.go')
-rw-r--r-- | lib/xdsconfig/fileconfig.go | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/xdsconfig/fileconfig.go b/lib/xdsconfig/fileconfig.go index 86f39b5..b786a24 100644 --- a/lib/xdsconfig/fileconfig.go +++ b/lib/xdsconfig/fileconfig.go @@ -28,9 +28,6 @@ import ( common "gerrit.automotivelinux.org/gerrit/src/xds/xds-common.git/golib" ) -// ConfigDir Directory in user HOME directory where xds config will be saved -var ConfigDir = path.Join(".xds", "server") - const ( // GlobalConfigFilename Global config filename GlobalConfigFilename = "server-config.json" @@ -74,8 +71,8 @@ func readGlobalConfig(c *Config, confFile string) error { if confFile != "" { searchIn = append(searchIn, confFile) } - if usr, err := user.Current(); err == nil { - searchIn = append(searchIn, path.Join(usr.HomeDir, ConfigDir, GlobalConfigFilename)) + if _, err := user.Current(); err == nil { + searchIn = append(searchIn, path.Join(ConfigRootDir(), GlobalConfigFilename)) } searchIn = append(searchIn, "/etc/xds/server/server-config.json") @@ -172,11 +169,7 @@ func readGlobalConfig(c *Config, confFile string) error { } func configFilenameGet(cfgFile string) (string, error) { - usr, err := user.Current() - if err != nil { - return "", err - } - return path.Join(usr.HomeDir, ConfigDir, cfgFile), nil + return path.Join(ConfigRootDir(), cfgFile), nil } // FoldersConfigFilenameGet Return the FoldersConfig filename |