github.com/kyma-incubator/compass/components/director@v0.0.0-20230623144113-d764f56ff805/internal/domain/apptemplate/config.go (about) 1 package apptemplate 2 3 import ( 4 "encoding/json" 5 "os" 6 7 "github.com/pkg/errors" 8 ) 9 10 // UnmarshalTenantMappingConfig unmarshalls a string into map[string]interface{} 11 func UnmarshalTenantMappingConfig(tenantMappingConfigPath string) (map[string]interface{}, error) { 12 fileContent, err := os.ReadFile(tenantMappingConfigPath) 13 if err != nil { 14 return nil, errors.Wrapf(err, "while reading tenant mapping config file %q", tenantMappingConfigPath) 15 } 16 17 var tenantMappingConfig map[string]interface{} 18 if err := json.Unmarshal(fileContent, &tenantMappingConfig); err != nil { 19 return nil, err 20 } 21 22 return tenantMappingConfig, nil 23 }