check for nil cmd
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
2d1e6db9fd
commit
d59db9df16
38
service.go
38
service.go
@ -43,25 +43,27 @@ func (s *service) Init(opts ...Option) {
|
||||
}
|
||||
|
||||
s.once.Do(func() {
|
||||
// set cmd name
|
||||
if len(s.opts.Cmd.App().Name) == 0 {
|
||||
s.opts.Cmd.App().Name = s.Server().Options().Name
|
||||
}
|
||||
if s.opts.Cmd != nil {
|
||||
// set cmd name
|
||||
if len(s.opts.Cmd.App().Name) == 0 {
|
||||
s.opts.Cmd.App().Name = s.Server().Options().Name
|
||||
}
|
||||
|
||||
// Initialise the command options
|
||||
if err := s.opts.Cmd.Init(
|
||||
cmd.Auth(&s.opts.Auth),
|
||||
cmd.Broker(&s.opts.Broker),
|
||||
cmd.Registry(&s.opts.Registry),
|
||||
cmd.Runtime(&s.opts.Runtime),
|
||||
cmd.Transport(&s.opts.Transport),
|
||||
cmd.Client(&s.opts.Client),
|
||||
cmd.Config(&s.opts.Config),
|
||||
cmd.Server(&s.opts.Server),
|
||||
cmd.Store(&s.opts.Store),
|
||||
cmd.Profile(&s.opts.Profile),
|
||||
); err != nil {
|
||||
logger.Fatalf("[cmd] init failed: %v", err)
|
||||
// Initialise the command options
|
||||
if err := s.opts.Cmd.Init(
|
||||
cmd.Auth(&s.opts.Auth),
|
||||
cmd.Broker(&s.opts.Broker),
|
||||
cmd.Registry(&s.opts.Registry),
|
||||
cmd.Runtime(&s.opts.Runtime),
|
||||
cmd.Transport(&s.opts.Transport),
|
||||
cmd.Client(&s.opts.Client),
|
||||
cmd.Config(&s.opts.Config),
|
||||
cmd.Server(&s.opts.Server),
|
||||
cmd.Store(&s.opts.Store),
|
||||
cmd.Profile(&s.opts.Profile),
|
||||
); err != nil {
|
||||
logger.Fatalf("[cmd] init failed: %v", err)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user