MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / Fetcher

Method Fetcher

pkg/config/shared.go:463–482  ·  view source on GitHub ↗

Fetcher returns fetch.Interface defined by conf. If no configuration source is set, this method returns nil, nil.

(ctx context.Context, httpClientProvider httpclient.Provider)

Source from the content-addressed store, hash-verified

461// Fetcher returns fetch.Interface defined by conf.
462// If no configuration source is set, this method returns nil, nil.
463func (c SenderClientCA) Fetcher(ctx context.Context, httpClientProvider httpclient.Provider) (fetch.Interface, error) {
464 switch c.Source {
465 case "directory":
466 return fetch.FromFilesystem(c.Directory), nil
467 case "url":
468 httpClient, err := httpClientProvider.HTTPClient(ctx, httpclient.WithCache(true))
469 if err != nil {
470 return nil, err
471 }
472 return fetch.FromHTTP(httpClient, c.URL)
473 case "blob":
474 b, err := c.BlobConfig.Bucket(ctx, c.Blob.Bucket, httpClientProvider)
475 if err != nil {
476 return nil, err
477 }
478 return fetch.FromBucket(ctx, b, c.Blob.Path), nil
479 default:
480 return nil, nil
481 }
482}
483
484// PacketBrokerInteropAuth respresents Packet Broker authentication configuration.
485type PacketBrokerInteropAuth struct {

Callers

nothing calls this directly

Calls 6

FromFilesystemFunction · 0.92
WithCacheFunction · 0.92
FromHTTPFunction · 0.92
FromBucketFunction · 0.92
BucketMethod · 0.80
HTTPClientMethod · 0.65

Tested by

no test coverage detected