Skip to content

Commit

Permalink
Don't create DefaultDataDir (#303)
Browse files Browse the repository at this point in the history
Fixes: #302

Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha authored Nov 13, 2020
1 parent ab8a4cf commit 58aa513
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions auth/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,15 @@ import (

"github.com/golang/glog"
authv1 "k8s.io/api/authentication/v1"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/client-go/util/homedir"
)

var DefaultDataDir = func() string {
dir := func() string {
if v, ok := os.LookupEnv("GUARD_DATA_DIR"); ok {
glog.Infof("Using data dir %s found in GUARD_DATA_DIR env variable", v)
return v
}
return filepath.Join(homedir.HomeDir(), ".guard")
}()
utilruntime.Must(os.MkdirAll(dir, 0755))
return dir
if v, ok := os.LookupEnv("GUARD_DATA_DIR"); ok {
glog.Infof("Using data dir %s found in GUARD_DATA_DIR env variable", v)
return v
}
return filepath.Join(homedir.HomeDir(), ".guard")
}()

type orgs []string
Expand Down

0 comments on commit 58aa513

Please sign in to comment.