diff --git a/server/options.go b/server/options.go index 2c2bf0ab..60c1fcdd 100644 --- a/server/options.go +++ b/server/options.go @@ -53,12 +53,15 @@ type Options struct { func NewOptions() Options { return Options{ + Auth: auth.DefaultAuth, Codecs: make(map[string]codec.NewCodec), Context: context.Background(), Metadata: map[string]string{}, RegisterInterval: DefaultRegisterInterval, RegisterTTL: DefaultRegisterTTL, RegisterCheck: DefaultRegisterCheck, + Broker: broker.DefaultBroker, + Registry: registry.DefaultRegistry, Address: DefaultAddress, Name: DefaultName, Version: DefaultVersion, diff --git a/service.go b/service.go index bb3c5f89..63fbad18 100644 --- a/service.go +++ b/service.go @@ -64,6 +64,30 @@ func (s *service) Init(opts ...Option) { logger.Fatalf("[cmd] init failed: %v", err) } + if err := s.opts.Registry.Init(); err != nil { + logger.Fatalf("[cmd] init failed: %v", err) + } + + if err := s.opts.Broker.Init(); err != nil { + logger.Fatalf("[cmd] init failed: %v", err) + } + + if err := s.opts.Transport.Init(); err != nil { + logger.Fatalf("[cmd] init failed: %v", err) + } + + if err := s.opts.Store.Init(); err != nil { + logger.Fatalf("[cmd] init failed: %v", err) + } + + if err := s.opts.Server.Init(); err != nil { + logger.Fatalf("[cmd] init failed: %v", err) + } + + if err := s.opts.Client.Init(); err != nil { + logger.Fatalf("[cmd] init failed: %v", err) + } + // execute the command // TODO: do this in service.Run() if err := s.opts.Cmd.Run(); err != nil {