func WriteConfigs(hal *config.Hal, dir string) error {
	if err := ensureDirectory(dir); err != nil {
		return err
	}
	services := transform.HalToServiceConfigs(hal)
	configFiles, err := transform.GenerateConfigFiles(services)
	if err != nil {
		return err
	}
	for _, file := range configFiles.GetConfigFile() {
		if err := ioutil.WriteFile(filepath.Join(dir, file.GetName()), file.GetContents(), 0666); err != nil {
			return err
		}
	}
	return nil
}
WriteConfigs generates the service configs from the supplied hal, and writes
them to the directory dir.
package fileio
import (
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"github.com/spinnaker/kleat/api/client/config"
	"github.com/spinnaker/kleat/internal/protoyaml"
	"github.com/spinnaker/kleat/internal/validate"
	"github.com/spinnaker/kleat/pkg/transform"
)
func ParseHalConfig(halPath string) (*config.Hal, error) {
	data, err := ioutil.ReadFile(halPath)
	if err != nil {
		return nil, fmt.Errorf("unable to read %q. Error: %v", halPath, err)
	}
	hal := &config.Hal{}
	if err := protoyaml.Unmarshal(data, hal); err != nil {
		return nil, fmt.Errorf("unable to unmarshal %q: %v", halPath, err)
	}
	if err := validate.HalConfig(hal); err != nil {
		return nil, fmt.Errorf("unable to validate %q: %v", halPath, err)
	}
	return hal, nil
}