devlog icon indicating copy to clipboard operation
devlog copied to clipboard

Add yaml based config for default content/options

Open automoto opened this issue 5 years ago • 0 comments

Add a yaml based configuration option.

Example of an older config

type DevLogConfig struct {
	Questions []string `yaml:"questions"`
	Other     []string `yaml:"other_section"`
}

func (c *DevLogConfig) getConfig(configFilePath string) *DevLogConfig {
	logPath := getLogContentPath(templateFilePath)
	if len(logPath) >=1 {
		yamlFile, err := ioutil.ReadFile(logPath)
		handleError(err)
		err = yaml.Unmarshal(yamlFile, c)
		handleError(err)
		return c
	}

	err := yaml.UnmarshalStrict([]byte(getDefaultQuestions()), c)
	handleError(err)
	return c
}

automoto avatar Oct 27 '20 06:10 automoto