Example #1
0
func (v Vulcand) Init() {
	if etcdmachines == "" {
		var err error
		etcdmachines, err = environment.GetEnvValue("ETCD_MACHINES")
		if err != nil {
			log.Fatal(err)
		} else {
			refreshEtcdMachines()
		}
	}

}
Example #2
0
func Init() {
	if heraldType == "" {
		var err error
		heraldType, err = environment.GetEnvValue("SERVICE_DECLARATION")
		if err != nil {
			log.Fatal(err)
		}
	}
	if dec, ok := heraldTypes[heraldType]; ok {
		DefaultHerald = dec
		DefaultHerald.Init()
		return
	}
	err := fmt.Errorf("Use of an unregistered herald type: %v")
	log.Fatal(err)
}
Example #3
0
func refreshEtcdMachines() {
	go func() {
		for _ = range time.Tick(time.Duration(environment.Frequency()) * time.Second) {
			machines, err := environment.GetEnvValue("ETCD_MACHINES")
			if err != nil || machines == "" {
				if err != nil {
					fmt.Fprint(os.Stderr, err)
				}
				if machines == "" {
					fmt.Fprintf(os.Stderr, "ETCD_MACHINES not set.")
				}
			} else {
				etcdmachines = machines
			}
		}
	}()
}