Example #1
0
func (s *Service) newEngine() error {
	box, err := s.newBox()
	if err != nil {
		return err
	}
	var ng engine.Engine

	if s.options.EtcdApiVersion == 3 {
		ng, err = etcdv3ng.New(
			s.options.EtcdNodes,
			s.options.EtcdKey,
			s.registry,
			etcdv3ng.Options{
				EtcdCaFile:              s.options.EtcdCaFile,
				EtcdCertFile:            s.options.EtcdCertFile,
				EtcdKeyFile:             s.options.EtcdKeyFile,
				EtcdConsistency:         s.options.EtcdConsistency,
				EtcdSyncIntervalSeconds: s.options.EtcdSyncIntervalSeconds,
				Box: box,
			})
	} else {
		ng, err = etcdv2ng.New(
			s.options.EtcdNodes,
			s.options.EtcdKey,
			s.registry,
			etcdv2ng.Options{
				EtcdCaFile:              s.options.EtcdCaFile,
				EtcdCertFile:            s.options.EtcdCertFile,
				EtcdKeyFile:             s.options.EtcdKeyFile,
				EtcdConsistency:         s.options.EtcdConsistency,
				EtcdSyncIntervalSeconds: s.options.EtcdSyncIntervalSeconds,
				Box: box,
			})
	}
	if err != nil {
		return err
	}
	s.ng = ng
	return err
}
Example #2
0
func (s *Service) newEngine() error {
	box, err := s.newBox()
	if err != nil {
		return err
	}
	ng, err := etcdv2ng.New(
		s.options.EtcdNodes,
		s.options.EtcdKey,
		s.registry,
		etcdv2ng.Options{
			EtcdCaFile:              s.options.EtcdCaFile,
			EtcdCertFile:            s.options.EtcdCertFile,
			EtcdKeyFile:             s.options.EtcdKeyFile,
			EtcdConsistency:         s.options.EtcdConsistency,
			EtcdSyncIntervalSeconds: s.options.EtcdSyncIntervalSeconds,
			Box: box,
		})
	if err != nil {
		return err
	}
	s.ng = ng
	return err
}