func (v Vulcand) Init() { if etcdmachines == "" { var err error etcdmachines, err = environment.GetEnvValue("ETCD_MACHINES") if err != nil { log.Fatal(err) } else { refreshEtcdMachines() } } }
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) }
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 } } }() }