Pass client to more of the runtime
This commit is contained in:
@@ -24,7 +24,7 @@ type service struct {
|
||||
}
|
||||
|
||||
func (m *service) Read() (set *source.ChangeSet, err error) {
|
||||
client := proto.NewConfigService(m.serviceName, client.DefaultClient)
|
||||
client := proto.NewConfigService(m.serviceName, m.opts.Client)
|
||||
req, err := client.Read(context.Background(), &proto.ReadRequest{
|
||||
Namespace: m.namespace,
|
||||
Path: m.path,
|
||||
@@ -37,7 +37,7 @@ func (m *service) Read() (set *source.ChangeSet, err error) {
|
||||
}
|
||||
|
||||
func (m *service) Watch() (w source.Watcher, err error) {
|
||||
client := proto.NewConfigService(m.serviceName, client.DefaultClient)
|
||||
client := proto.NewConfigService(m.serviceName, m.opts.Client)
|
||||
stream, err := client.Watch(context.Background(), &proto.WatchRequest{
|
||||
Namespace: m.namespace,
|
||||
Path: m.path,
|
||||
@@ -87,6 +87,10 @@ func NewSource(opts ...source.Option) source.Source {
|
||||
}
|
||||
}
|
||||
|
||||
if options.Client == nil {
|
||||
options.Client = client.DefaultClient
|
||||
}
|
||||
|
||||
s := &service{
|
||||
serviceName: addr,
|
||||
opts: options,
|
||||
|
Reference in New Issue
Block a user