mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-24 10:07:04 +02:00
on service.Init only process options once
This commit is contained in:
parent
a933aa79c6
commit
b43985401a
@ -68,9 +68,11 @@ func (s *service) Init(opts ...Option) {
|
||||
// This is pretty ugly, find a better way
|
||||
options := newOptions()
|
||||
options.Cmd = s.opts.Cmd
|
||||
|
||||
for _, o := range opts {
|
||||
o(&options)
|
||||
}
|
||||
|
||||
s.opts.Cmd = options.Cmd
|
||||
|
||||
// Initialise the command flags, overriding new service
|
||||
@ -82,11 +84,6 @@ func (s *service) Init(opts ...Option) {
|
||||
cmd.Server(&s.opts.Server),
|
||||
)
|
||||
}
|
||||
|
||||
// Update any options to override command flags
|
||||
for _, o := range opts {
|
||||
o(&s.opts)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *service) Options() Options {
|
||||
|
Loading…
Reference in New Issue
Block a user