code: func (cfg *loadBalancerConfig) write(services map[string][]service, dryRun bool) (err error) {
  	var w io.Writer
  	if dryRun {
  		w = os.Stdout
  	} else {
  		w, err = os.Create(cfg.Config)
  		if err != nil {
  			return
  		}
  	}
  	var t *template.Template
  	t, err = template.ParseFiles(cfg.Template)
  	if err != nil {
  		return
  	}
  
  	conf := make(map[string]interface{})
  	conf["startSyslog"] = strconv.FormatBool(cfg.startSyslog)
  	conf["services"] = services
  
  	var sslConfig string
  	if cfg.sslCert != "" {
  		sslConfig = "crt " + cfg.sslCert
  	}
  	if cfg.sslCaCert != "" {
  		sslConfig += " ca-file " + cfg.sslCaCert
  	}
  	conf["sslCert"] = sslConfig
  
  	// default load balancer algorithm is roundrobin
  	conf["defLbAlgorithm"] = lbDefAlgorithm
  	if cfg.lbDefAlgorithm != "" {
  		conf["defLbAlgorithm"] = cfg.lbDefAlgorithm
  	}
  
  	err = t.Execute(w, conf)
  	return
  }
docs: // write writes the configuration file, will write to stdout if dryRun == true