Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

now sets the cache dir correctly #1811

Merged
merged 3 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions cmd/vclusterctl/cmd/platform/platform.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
package platform

import (
"path/filepath"

"github.com/loft-sh/vcluster/cmd/vclusterctl/cmd/platform/add"
"github.com/loft-sh/vcluster/cmd/vclusterctl/cmd/platform/connect"
"github.com/loft-sh/vcluster/cmd/vclusterctl/cmd/platform/get"
"github.com/loft-sh/vcluster/cmd/vclusterctl/cmd/platform/list"
"github.com/loft-sh/vcluster/cmd/vclusterctl/cmd/platform/set"
"github.com/loft-sh/vcluster/pkg/cli/config"
"github.com/loft-sh/vcluster/pkg/cli/flags"
"github.com/loft-sh/vcluster/pkg/platform"
"github.com/loft-sh/vcluster/pkg/platform/defaults"
"github.com/mitchellh/go-homedir"
"github.com/spf13/cobra"
)

Expand All @@ -23,7 +25,11 @@ func NewPlatformCmd(globalFlags *flags.GlobalFlags, cfg *config.CLI) (*cobra.Com
`,
Args: cobra.NoArgs,
}
defaults, err := defaults.NewFromPath(platform.CacheFolder, defaults.ConfigFile)
home, err := homedir.Dir()
if err != nil {
return nil, err
}
defaults, err := defaults.NewFromPath(filepath.Join(home, defaults.ConfigFolder), defaults.ConfigFile)
if err != nil {
return nil, err
}
Expand Down
10 changes: 8 additions & 2 deletions cmd/vclusterctl/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import (
"context"
"fmt"
"os"
"path/filepath"

pdefaults "github.com/loft-sh/vcluster/pkg/platform/defaults"
"github.com/loft-sh/vcluster/pkg/platform/defaults"
"github.com/mitchellh/go-homedir"

"github.com/loft-sh/log"
"github.com/loft-sh/vcluster/cmd/vclusterctl/cmd/convert"
Expand Down Expand Up @@ -89,7 +91,11 @@ func BuildRoot(log log.Logger) (*cobra.Command, error) {
persistentFlags := rootCmd.PersistentFlags()
globalFlags = flags.SetGlobalFlags(persistentFlags, log)
cfg := globalFlags.LoadedConfig(log)
defaults, err := pdefaults.NewFromPath(pdefaults.ConfigFolder, pdefaults.ConfigFile)
home, err := homedir.Dir()
if err != nil {
return nil, err
}
defaults, err := defaults.NewFromPath(filepath.Join(home, defaults.ConfigFolder), defaults.ConfigFile)
if err != nil {
log.Debugf("Error loading defaults: %v", err)
return nil, err
Expand Down
Loading