Explorar o código

create cluster security logic

Mohammed Nafees %!s(int64=3) %!d(string=hai) anos
pai
achega
276f5f9c6f
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      internal/repository/gorm/cluster.go

+ 5 - 0
internal/repository/gorm/cluster.go

@@ -132,6 +132,11 @@ func (repo *ClusterRepository) CreateCluster(
 		return nil, err
 	}
 
+	if cluster.PreviewEnvsEnabled && !project.PreviewEnvsEnabled {
+		// this should only work if the corresponding project has preview environments enabled
+		cluster.PreviewEnvsEnabled = false
+	}
+
 	assoc := repo.db.Model(&project).Association("Clusters")
 
 	if assoc.Error != nil {