Kaynağa Gözat

Merge pull request #1958 from porter-dev/belanger/hotfix-subdomain

Track down custom subdomain with proper interface conversion
abelanger5 4 yıl önce
ebeveyn
işleme
8186e97093
2 değiştirilmiş dosya ile 11 ekleme ve 5 silme
  1. 5 3
      cli/cmd/apply.go
  2. 6 2
      cli/cmd/deploy/create.go

+ 5 - 3
cli/cmd/apply.go

@@ -803,11 +803,13 @@ func (t *DeploymentHook) DataQueries() map[string]interface{} {
 							hostsArr, hostsExists := ingressMap["hosts"]
 
 							if hostsExists {
-								hostsArrVal, hostsArrOk := hostsArr.([]string)
+								hostsArrVal, hostsArrOk := hostsArr.([]interface{})
 
 								if hostsArrOk && len(hostsArrVal) > 0 {
-									res[resource.Name] = fmt.Sprintf("{ .%s.ingress.hosts[0] }", resource.Name)
-									isCustomDomain = true
+									if _, ok := hostsArrVal[0].(string); ok {
+										res[resource.Name] = fmt.Sprintf("{ .%s.ingress.hosts[0] }", resource.Name)
+										isCustomDomain = true
+									}
 								}
 							}
 						}

+ 6 - 2
cli/cmd/deploy/create.go

@@ -534,10 +534,14 @@ func (c *CreateAgent) CreateSubdomainIfRequired(mergedValues map[string]interfac
 						hostsArr, hostsExists := ingressMap["hosts"]
 
 						if hostsExists {
-							hostsArrVal, hostsArrOk := hostsArr.([]string)
+							hostsArrVal, hostsArrOk := hostsArr.([]interface{})
 
 							if hostsArrOk && len(hostsArrVal) > 0 {
-								subdomain = hostsArrVal[0]
+								subdomainStr, ok := hostsArrVal[0].(string)
+
+								if ok {
+									subdomain = subdomainStr
+								}
 							}
 						}
 					} else {