Skip to content

Commit d930fb9

Browse files
authored
proxy: add method to retrieve the client-config (#889)
1 parent 0a80c8d commit d930fb9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

backend/common.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,3 +285,17 @@ func (s *DataSourceInstanceSettings) ProxyOptions(clientCfg *proxy.ClientCfg) (*
285285

286286
return opts, nil
287287
}
288+
289+
func (s *DataSourceInstanceSettings) ProxyClient(ctx context.Context) (proxy.Client, error) {
290+
cfg := GrafanaConfigFromContext(ctx)
291+
p, err := cfg.proxy()
292+
if err != nil {
293+
return nil, err
294+
}
295+
proxyOpts, err := s.ProxyOptions(p.clientCfg)
296+
if err != nil {
297+
return nil, err
298+
}
299+
300+
return proxy.New(proxyOpts), nil
301+
}

0 commit comments

Comments
 (0)