in internal/cmd/integrations/apply.go [450:488]
func processSfdcInstances(sfdcinstancesFolder string) (err error) {
var stat fs.FileInfo
rJSONFiles := regexp.MustCompile(`(\S*)\.json`)
if stat, err = os.Stat(sfdcinstancesFolder); err == nil && stat.IsDir() {
// create any sfdc instances
err = filepath.Walk(sfdcinstancesFolder, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
if !info.IsDir() {
instanceFile := filepath.Base(path)
if rJSONFiles.MatchString(instanceFile) {
clilog.Info.Printf("Found configuration for sfdc instance: %s\n", instanceFile)
_, err = sfdc.GetInstance(getFilenameWithoutExtension(instanceFile), true)
// create the instance only if the sfdc instance is not found
if err != nil {
instanceBytes, err := utils.ReadFile(path)
if err != nil {
return err
}
clilog.Info.Printf("Creating sfdc instance: %s\n", instanceFile)
_, err = sfdc.CreateInstanceFromContent(instanceBytes)
if err != nil {
return nil
}
} else {
clilog.Info.Printf("sfdc instance %s already exists\n", instanceFile)
}
}
}
return nil
})
if err != nil {
return err
}
}
return nil
}