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
|
// This is pretty ugly, find a better way
|
||||||
options := newOptions()
|
options := newOptions()
|
||||||
options.Cmd = s.opts.Cmd
|
options.Cmd = s.opts.Cmd
|
||||||
|
|
||||||
for _, o := range opts {
|
for _, o := range opts {
|
||||||
o(&options)
|
o(&options)
|
||||||
}
|
}
|
||||||
|
|
||||||
s.opts.Cmd = options.Cmd
|
s.opts.Cmd = options.Cmd
|
||||||
|
|
||||||
// Initialise the command flags, overriding new service
|
// Initialise the command flags, overriding new service
|
||||||
@ -82,11 +84,6 @@ func (s *service) Init(opts ...Option) {
|
|||||||
cmd.Server(&s.opts.Server),
|
cmd.Server(&s.opts.Server),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update any options to override command flags
|
|
||||||
for _, o := range opts {
|
|
||||||
o(&s.opts)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *service) Options() Options {
|
func (s *service) Options() Options {
|
||||||
|
Loading…
Reference in New Issue
Block a user