init default stuff
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
e7d418183b
commit
5fe3a46732
@ -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,
|
||||
|
24
service.go
24
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user