mirror of
https://github.com/go-micro/go-micro.git
synced 2025-05-31 21:59:42 +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)
|
s.opts.Logger.Log(log.FatalLevel, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Explicitly set the table name to the service name
|
// If the store has no Table set, fallback to the
|
||||||
name := s.opts.Cmd.App().Name
|
// services name
|
||||||
err := s.opts.Store.Init(store.Table(name))
|
if len(s.opts.Store.Options().Table) == 0 {
|
||||||
if err != nil {
|
name := s.opts.Cmd.App().Name
|
||||||
s.opts.Logger.Log(log.FatalLevel, err)
|
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