github.com/kyma-project/kyma-environment-broker@v0.0.1/internal/provider/region_mapping.go (about)

     1  package provider
     2  
     3  import (
     4  	"fmt"
     5  	"io/ioutil"
     6  
     7  	"gopkg.in/yaml.v2"
     8  )
     9  
    10  func ReadPlatformRegionMappingFromFile(filename string) (map[string]string, error) {
    11  	regionConfig, err := ioutil.ReadFile(filename)
    12  	if err != nil {
    13  		return map[string]string{}, fmt.Errorf("while reading %s file with region mapping config: %w", filename, err)
    14  	}
    15  	var data map[string]string
    16  	err = yaml.Unmarshal(regionConfig, &data)
    17  	if err != nil {
    18  		return map[string]string{}, fmt.Errorf("while unmarshalling a file with region mapping config: %w", err)
    19  	}
    20  	return data, nil
    21  }