Browse Source

sort domains (#4146)

Feroze Mohideen 2 năm trước cách đây
mục cha
commit
4af20c2d5e
1 tập tin đã thay đổi với 10 bổ sung0 xóa
  1. 10 0
      api/server/handlers/porter_app/yaml_from_revision.go

+ 10 - 0
api/server/handlers/porter_app/yaml_from_revision.go

@@ -186,6 +186,16 @@ func (c *PorterYAMLFromRevisionHandler) ServeHTTP(w http.ResponseWriter, r *http
 	})
 	app.Services = sortedServices
 
+	servicesWithDomainsSorted := app.Services
+	for i := range servicesWithDomainsSorted {
+		sortedDomains := servicesWithDomainsSorted[i].Domains
+		sort.Slice(sortedDomains, func(i, j int) bool {
+			return sortedDomains[i].Name < sortedDomains[j].Name
+		})
+		servicesWithDomainsSorted[i].Domains = sortedDomains
+	}
+	app.Services = servicesWithDomainsSorted
+
 	// sort env variables by key
 	sortedEnv := app.Env
 	sort.Slice(sortedEnv, func(i, j int) bool {