From 6aaa24640f84608588fa673cc6355e29127de40b Mon Sep 17 00:00:00 2001 From: fabiankramm Date: Fri, 19 Oct 2018 15:38:03 +0200 Subject: [PATCH] Fix nil pointer when using devspace cloud --- pkg/devspace/cloud/config.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pkg/devspace/cloud/config.go b/pkg/devspace/cloud/config.go index 3306feaa98..18cfdbcf4f 100644 --- a/pkg/devspace/cloud/config.go +++ b/pkg/devspace/cloud/config.go @@ -40,6 +40,7 @@ const GetClusterConfigEndpoint = "/clusterConfig" // DevSpaceCloudProviderConfig holds the information for the devspace-cloud var DevSpaceCloudProviderConfig = &Provider{ + Name: DevSpaceCloudProviderName, Host: "http://cli.devspace-cloud.com", } @@ -84,16 +85,22 @@ func SaveCloudConfig(config ProviderConfig) error { } cfgPath := filepath.Join(homedir, DevSpaceCloudConfigPath) + saveConfig := ProviderConfig{} for name, provider := range config { - provider.Name = "" - + host := provider.Host if name == DevSpaceCloudProviderName { - provider.Host = "" + host = "" + } + + saveConfig[name] = &Provider{ + Name: "", + Host: host, + Token: provider.Token, } } - out, err := yaml.Marshal(config) + out, err := yaml.Marshal(saveConfig) if err != nil { return err }