Example #1
0
// Launch launch confd as a daemon process.
func Launch(signalChan chan os.Signal, etcd []string) {
	confdLogLevel := "error"
	if log.Level.String() == "debug" {
		confdLogLevel = "debug"
	}
	cmdAsString := fmt.Sprintf("confd -node %v -confdir /app --interval %v --log-level %v", confdInterval, strings.Join(etcd, ","), confdLogLevel)
	cmd, args := oswrapper.BuildCommandFromString(cmdAsString)
	go runConfdDaemon(signalChan, cmd, args)
}
Example #2
0
// WaitForInitialConf wait until the compilation of the templates is correct
func WaitForInitialConf(etcd []string, timeout time.Duration) {
	log.Info("waiting for confd to write initial templates...")
	for {
		cmdAsString := fmt.Sprintf("confd -onetime -node %v -confdir /app", strings.Join(etcd, ","))
		log.Debugf("running %s", cmdAsString)
		cmd, args := oswrapper.BuildCommandFromString(cmdAsString)
		err := oswrapper.RunCommand(cmd, args)
		if err == nil {
			break
		}

		time.Sleep(timeout)
	}
}