Skip to content

Commit 97ad2fc

Browse files
committed
fix: remove old workaround for migrating config file name
1 parent 06baccd commit 97ad2fc

File tree

1 file changed

+0
-40
lines changed

1 file changed

+0
-40
lines changed

cmd/rhoas/main.go

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"encoding/json"
66
"fmt"
77
"os"
8-
"path/filepath"
98

109
"github.com/redhat-developer/app-services-cli/pkg/api/kas"
1110
"github.com/redhat-developer/app-services-cli/pkg/doc"
@@ -96,13 +95,6 @@ func generateDocumentation(rootCommand *cobra.Command) {
9695
}
9796

9897
func initConfig(f *factory.Factory) {
99-
// check if the config file is located in the old default location
100-
// if so, move it to the new location
101-
err := moveConfigFile(f.Config)
102-
if err != nil {
103-
fmt.Fprintf(f.IOStreams.ErrOut, "Error migrating config file to new location: %v", err)
104-
}
105-
10698
cfgFile, err := f.Config.Load()
10799

108100
if cfgFile != nil {
@@ -119,35 +111,3 @@ func initConfig(f *factory.Factory) {
119111
os.Exit(1)
120112
}
121113
}
122-
123-
// check if the config file is located in the old default location
124-
// if so, move it to the new location
125-
func moveConfigFile(cfg config.IConfig) error {
126-
cfgPath, err := cfg.Location()
127-
if err != nil {
128-
return err
129-
}
130-
rhoasCfgDir, err := config.DefaultDir()
131-
if err != nil {
132-
return err
133-
}
134-
userCfgDir, err := os.UserConfigDir()
135-
if err != nil {
136-
return err
137-
}
138-
oldFilePath := filepath.Join(userCfgDir, ".rhoascli.json")
139-
if os.Getenv("RHOASCONFIG") == oldFilePath {
140-
return nil
141-
}
142-
// create rhoas config directory
143-
if _, err = os.Stat(rhoasCfgDir); os.IsNotExist(err) {
144-
err = os.MkdirAll(rhoasCfgDir, 0o700)
145-
if err != nil {
146-
return err
147-
}
148-
}
149-
if _, err = os.Stat(oldFilePath); err == nil {
150-
return os.Rename(oldFilePath, cfgPath)
151-
}
152-
return nil
153-
}

0 commit comments

Comments
 (0)