// UnmarshalDefaultVars un-marshalls the default vars from proffer template file.
UnmarshalDefaultVars un-marshalls the default vars from proffer template file.
// UnmarshalDefaultVars un - marshalls the default vars from proffer template file .
func UnmarshalDefaultVars(defaultVarsPath string) error {
	clogger.Debug("")
	clogger.Debug("Resetting default vars.")
	defaultVars = DefaultVars{}
	if _, err := os.Stat(defaultVarsPath); os.IsNotExist(err) {
		return err
	}
	defaultVarsData, err := ioutil.ReadFile(defaultVarsPath)
	if err != nil {
		return err
	}
	pattern := regexp.MustCompile(`(?m)^resources:$`)
	loc := pattern.FindIndex(defaultVarsData)
	clogger.Debug("Populate default vars if any.")
	err = yaml.UnmarshalStrict(defaultVarsData[:loc[0]], &defaultVars)
	if err != nil {
		return err
	}
	clogger.Debug("Parsed default vars.")
	return nil
}
func UnmarshalDefaultVars ( defaultVarsPath string ) error { clogger . Debug ( " " ) clogger . Debug ( " " ) defaultVars = DefaultVars { } if _ , err := os . Stat ( defaultVarsPath ) ; os . IsNotExist ( err ) { return err } defaultVarsData , err := ioutil . ReadFile ( defaultVarsPath ) if err != nil { return err } pattern := regexp . MustCompile ( `(?m)^resources:$` ) loc := pattern . FindIndex ( defaultVarsData ) clogger . Debug ( " " ) err = yaml . UnmarshalStrict ( defaultVarsData [ : loc [ 0 ] ] , & defaultVars ) if err != nil { return err } clogger . Debug ( " " ) return nil }
UnmarshalDefaultVars un-marshalls the default vars from proffer template file.
UnmarshalDefaultVars un - marshalls the default vars from proffer template file .
// Reset defaultVars global var. // Check default vars file. // Populate default vars. // Regex pattern captures "^resources:" from the content // because its reserved word to specify resource list so // not allowed any other key with same name at top level scope.