cleanup
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
6998184d9e
commit
89d804f9e6
18
service.go
18
service.go
@ -17,6 +17,7 @@ type serviceBroker struct {
|
||||
addrs []string
|
||||
service string
|
||||
client pbmicro.BrokerClient
|
||||
init bool
|
||||
opts broker.Options
|
||||
}
|
||||
|
||||
@ -33,6 +34,10 @@ func (b *serviceBroker) Disconnect(ctx context.Context) error {
|
||||
}
|
||||
|
||||
func (b *serviceBroker) Init(opts ...broker.Option) error {
|
||||
if len(opts) == 0 && b.init {
|
||||
return nil
|
||||
}
|
||||
|
||||
for _, o := range opts {
|
||||
o(&b.opts)
|
||||
}
|
||||
@ -47,6 +52,19 @@ func (b *serviceBroker) Init(opts ...broker.Option) error {
|
||||
}
|
||||
}
|
||||
|
||||
if err := b.opts.Register.Init(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := b.opts.Tracer.Init(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := b.opts.Logger.Init(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := b.opts.Meter.Init(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if b.service == "" {
|
||||
return fmt.Errorf("missing Service option")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user