Skip to content

Commit 6aaa246

Browse files
committed
Fix nil pointer when using devspace cloud
1 parent fc89358 commit 6aaa246

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

pkg/devspace/cloud/config.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const GetClusterConfigEndpoint = "/clusterConfig"
4040

4141
// DevSpaceCloudProviderConfig holds the information for the devspace-cloud
4242
var DevSpaceCloudProviderConfig = &Provider{
43+
Name: DevSpaceCloudProviderName,
4344
Host: "http://cli.devspace-cloud.com",
4445
}
4546

@@ -84,16 +85,22 @@ func SaveCloudConfig(config ProviderConfig) error {
8485
}
8586

8687
cfgPath := filepath.Join(homedir, DevSpaceCloudConfigPath)
88+
saveConfig := ProviderConfig{}
8789

8890
for name, provider := range config {
89-
provider.Name = ""
90-
91+
host := provider.Host
9192
if name == DevSpaceCloudProviderName {
92-
provider.Host = ""
93+
host = ""
94+
}
95+
96+
saveConfig[name] = &Provider{
97+
Name: "",
98+
Host: host,
99+
Token: provider.Token,
93100
}
94101
}
95102

96-
out, err := yaml.Marshal(config)
103+
out, err := yaml.Marshal(saveConfig)
97104
if err != nil {
98105
return err
99106
}

0 commit comments

Comments
 (0)