Skip to content

Commit 89a4124

Browse files
fixed bad access to user home dir (#197)
1 parent 551e035 commit 89a4124

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

venona/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.5.2
1+
1.5.3

venonactl/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.5.2
1+
1.5.3

venonactl/cmd/cmdutils.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,14 @@ func buildBasicStore(logger logger.Logger) {
7070
func extendStoreWithCodefershClient(logger logger.Logger) error {
7171
s := store.GetStore()
7272
if configPath == "" {
73-
configPath = fmt.Sprintf("%s/.cfconfig", os.Getenv("HOME"))
73+
currentUser, err := user.Current()
74+
if err != nil {
75+
return err
76+
}
77+
78+
configPath := path.Join(currentUser.HomeDir, ".cfconfig")
79+
logger.Debug("cfconfig path not set, using:", "cfconfig", configPath)
80+
7481
}
7582

7683
if cfAPIHost == "" && cfAPIToken == "" {
@@ -82,7 +89,7 @@ func extendStoreWithCodefershClient(logger logger.Logger) error {
8289
cfAPIToken = context.Token
8390
logger.Debug("Using codefresh context", "Context-Name", context.Name, "Host", cfAPIHost)
8491
} else {
85-
logger.Debug("Reading creentials from environment variables")
92+
logger.Debug("Reading credentials from environment variables")
8693
if cfAPIHost == "" {
8794
cfAPIHost = "https://g.codefresh.io"
8895
}
@@ -111,7 +118,7 @@ func extendStoreWithKubeClient(logger logger.Logger) {
111118
currentUser, _ := user.Current()
112119
if currentUser != nil {
113120
kubeConfigPath = path.Join(currentUser.HomeDir, ".kube", "config")
114-
logger.Debug("Path to kubeconfig not set, using default")
121+
logger.Debug("Path to kubeconfig not set, using:", "kubeconfig", kubeConfigPath)
115122
}
116123
}
117124

0 commit comments

Comments
 (0)