// Generates the new config to be written
Generates the new config to be written
// Generates the new config to be written
func generateConfig(templatePath string, conf *configuration.Configuration, conn *zk.Conn) (config string, err error) {
	templateContent, err := ioutil.ReadFile(templatePath)
	if err != nil {
		log.Println("Failed to read template contents")
		return
	}
	templateData, err := haproxy.GetTemplateData(conf, conn)
	if err != nil {
		log.Println("Failed to retrieve template data")
		return
	}
	config, err = template.RenderTemplate(templatePath, string(templateContent), templateData)
	if err != nil {
		log.Println("Template syntax error")
		return
	}
	return
}
func generateConfig ( templatePath string , conf * configuration . Configuration , conn * zk . Conn ) ( config string , err error ) { templateContent , err := ioutil . ReadFile ( templatePath ) if err != nil { log . Println ( " " ) return } templateData , err := haproxy . GetTemplateData ( conf , conn ) if err != nil { log . Println ( " " ) return } config , err = template . RenderTemplate ( templatePath , string ( templateContent ) , templateData ) if err != nil { log . Println ( " " ) return } return }
Generates the new config to be written
Generates the new config to be written