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

Method Fetcher

pkg/config/shared.go:629–645  ·  view source on GitHub ↗

Fetcher returns a fetch.Interface based on the configuration. If no configuration source is set, this method returns nil, nil.

(ctx context.Context,
	blobConf BlobConfig,
	httpClientProvider httpclient.Provider,
)

Source from the content-addressed store, hash-verified

627// Fetcher returns a fetch.Interface based on the configuration.
628// If no configuration source is set, this method returns nil, nil.
629func (c MTLSAuthConfig) Fetcher(ctx context.Context,
630 blobConf BlobConfig,
631 httpClientProvider httpclient.Provider,
632) (fetch.Interface, error) {
633 switch c.Source {
634 case "directory":
635 return fetch.FromFilesystem(c.Directory), nil
636 case "blob":
637 b, err := blobConf.Bucket(ctx, c.Blob.Bucket, httpClientProvider)
638 if err != nil {
639 return nil, err
640 }
641 return fetch.FromBucket(ctx, b, c.Blob.Path), nil
642 default:
643 return nil, nil
644 }
645}

Callers

nothing calls this directly

Calls 3

FromFilesystemFunction · 0.92
FromBucketFunction · 0.92
BucketMethod · 0.80

Tested by

no test coverage detected