call cmd.Run

This commit is contained in:
Asim Aslam
2020-07-19 18:20:17 +01:00
parent 755b816086
commit 16c591d741
2 changed files with 9 additions and 1 deletions

View File

@@ -99,7 +99,7 @@ func (s *service) Init(opts ...Option) {
s.opts.Cmd.App().Name = s.Server().Options().Name
}
// Initialise the command flags, overriding new service
// Initialise the command options
if err := s.opts.Cmd.Init(
cmd.Auth(&s.opts.Auth),
cmd.Broker(&s.opts.Broker),
@@ -115,6 +115,12 @@ func (s *service) Init(opts ...Option) {
logger.Fatal(err)
}
// execute the command
// TODO: do this in service.Run()
if err := s.opts.Cmd.Run(); err != nil {
logger.Fatal(err)
}
// Explicitly set the table name to the service name
name := s.opts.Cmd.App().Name
s.opts.Store.Init(store.Table(name))