Skip to content

Commit

Permalink
fix: place the config file in XDG_CONFIG_HOME instead of HOME (#467)
Browse files Browse the repository at this point in the history
  • Loading branch information
rkpattnaik780 authored Mar 17, 2021
1 parent 10618b8 commit 4a999f2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/BurntSushi/toml v0.3.1
github.com/MakeNowJust/heredoc v1.0.0
github.com/Nerzal/gocloak/v7 v7.7.0
github.com/ProtonMail/go-appdir v1.1.0
github.com/coreos/go-oidc v2.2.1+incompatible
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/dustin/go-humanize v1.0.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ github.com/Nerzal/gocloak/v7 v7.7.0/go.mod h1:tJ0yV6jds2dm1a5eYW7km/bt+2F3mqlU0e
github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8 h1:xzYJEypr/85nBpB11F9br+3HUrpgb+fcm5iADzXXYEw=
github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/ProtonMail/go-appdir v1.1.0 h1:9hdNDlU9kTqRKVNzmoqah8qqrj5QZyLByQdwQNlFWig=
github.com/ProtonMail/go-appdir v1.1.0/go.mod h1:3d8Y9F5mbEUjrYbcJ3rcDxcWbqbttF+011nVZmdRdzc=
github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
Expand Down
9 changes: 3 additions & 6 deletions internal/config/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import (
"fmt"
"io/ioutil"
"os"
"path/filepath"

"github.com/bf2fc6cc711aee1a0c2a/cli/internal/localizer"

"github.com/ProtonMail/go-appdir"
)

// NewFile creates a new config type
Expand Down Expand Up @@ -86,11 +87,7 @@ func (c *File) Location() (path string, err error) {
if rhoasConfig := os.Getenv("RHOASCLI_CONFIG"); rhoasConfig != "" {
path = rhoasConfig
} else {
home, err := os.UserHomeDir()
if err != nil {
return "", err
}
path = filepath.Join(home, ".rhoascli.json")
path = appdir.New(".rhoascli.json").UserConfig()
}
return path, nil
}

0 comments on commit 4a999f2

Please sign in to comment.