func configFromYAML()

in astro/config.go [71:102]


func configFromYAML(yamlBytes []byte, rootPath string) (*conf.Project, error) {
	var config conf.Project

	err := yaml.Unmarshal(yamlBytes, &config)
	if err != nil {
		return nil, err
	}

	// Convert rootPath to absolute
	rootPath, err = filepath.Abs(rootPath)
	if err != nil {
		return nil, err
	}

	// Rewrite paths to absolute
	if err := rewriteConfigPaths(rootPath, &config); err != nil {
		return nil, fmt.Errorf("failed to resolve relative paths in config file: %s; %v", rootPath, err)
	}

	// Set configuration defaults
	if err := setDefaults(&config, rootPath); err != nil {
		return nil, err
	}

	// Fill in Terraform versions. This has to be done after paths are
	// rewritten.
	if err := setTerraformVersionFields(&config); err != nil {
		return nil, err
	}

	return &config, nil
}