mirror of
https://github.com/go-micro/go-micro.git
synced 2025-01-17 17:44:30 +02:00
fix: store table initialization (#2584)
This commit is contained in:
parent
a3980c2308
commit
b988a78bae
13
service.go
13
service.go
@ -61,11 +61,14 @@ func (s *service) Init(opts ...Option) {
|
||||
s.opts.Logger.Log(log.FatalLevel, err)
|
||||
}
|
||||
|
||||
// Explicitly set the table name to the service name
|
||||
name := s.opts.Cmd.App().Name
|
||||
err := s.opts.Store.Init(store.Table(name))
|
||||
if err != nil {
|
||||
s.opts.Logger.Log(log.FatalLevel, err)
|
||||
// If the store has no Table set, fallback to the
|
||||
// services name
|
||||
if len(s.opts.Store.Options().Table) == 0 {
|
||||
name := s.opts.Cmd.App().Name
|
||||
err := s.opts.Store.Init(store.Table(name))
|
||||
if err != nil {
|
||||
s.opts.Logger.Log(log.FatalLevel, err)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user