func()

in app/registry/resources.go [32:79]


func (a *App) prepareRegistryResources(_ *gin.Context, r *registry, values *Values,
	_ map[string]map[string]interface{}, mrActions *[]string) (bool, error) {

	globalInterface, ok := values.OriginalYaml[GlobalValuesIndex]
	if !ok {
		globalInterface = make(map[string]interface{})
	}
	globalDict := globalInterface.(map[string]interface{})

	valuesChanged := false

	if r.Resources != "" {
		var resources map[string]interface{}
		if err := json.Unmarshal([]byte(r.Resources), &resources); err != nil {
			return false, errors.Wrap(err, "unable to decode resources")
		}

		if !reflect.DeepEqual(resources, globalDict[ResourcesIndex]) {
			valuesChanged = true
			globalDict[ResourcesIndex] = resources
			values.OriginalYaml[GlobalValuesIndex] = globalDict
		}
	}

	if r.CrunchyPostgresMaxConnections != "" {
		maxCon, err := strconv.ParseInt(r.CrunchyPostgresMaxConnections, 10, 32)
		if err != nil {
			return false, fmt.Errorf("unable to parse max connectrions, %w", err)
		}

		if values.Global.CrunchyPostgres.CrunchyPostgresPostgresql.CrunchyPostgresPostgresqlParameters.MaxConnections != int(maxCon) {
			values.Global.CrunchyPostgres.CrunchyPostgresPostgresql.CrunchyPostgresPostgresqlParameters.MaxConnections = int(maxCon)

			globalDict[CrunchyPostgresIndex] = values.Global.CrunchyPostgres
			values.OriginalYaml[GlobalValuesIndex] = globalDict
			valuesChanged = true
		}
	}

	if r.CrunchyPostgresStorageSize != "" && values.Global.CrunchyPostgres.StorageSize != r.CrunchyPostgresStorageSize {
		values.Global.CrunchyPostgres.StorageSize = r.CrunchyPostgresStorageSize
		globalDict[CrunchyPostgresIndex] = values.Global.CrunchyPostgres
		globalDict[CrunchyPostgresIndex] = values.Global.CrunchyPostgres
		valuesChanged = true
	}

	return valuesChanged, nil
}