Преглед на файлове

create cluster security logic

Mohammed Nafees преди 3 години
родител
ревизия
276f5f9c6f
променени са 1 файла, в които са добавени 5 реда и са изтрити 0 реда
  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 {