// NewService returns a new instance of Service. func NewService(c Config, m *meta.Config) *Service { strPort := strconv.Itoa(m.ServicePort) ticker := time.NewTicker(time.Duration(c.CheckInterval)) s := &Service{ serviceAddr: utils.GetServiceAddress(), servicePort: strPort, config: c, ticker: ticker, err: make(chan error), Logger: log.New(os.Stderr, "[health] ", log.LstdFlags), } return s }
// NewService returns a new instance of Service. func NewService(c Config, m *meta.Config) *Service { strPort := strconv.Itoa(m.ServicePort) ticker := time.NewTicker(time.Second * 2) s := &Service{ serviceAddr: utils.GetServiceAddress(), servicePort: strPort, config: c, ticker: ticker, routeName: getRandomRouteName(5), err: make(chan error), Logger: log.New(os.Stderr, "[registration] ", log.LstdFlags), keysOptions: &client.SetOptions{ TTL: time.Duration(c.TTL), }, } return s }