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

Method Fetcher

pkg/config/shared.go:588–609  ·  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, blobConf BlobConfig, httpClientProvider httpclient.Provider,
)

Source from the content-addressed store, hash-verified

586// Fetcher returns fetch.Interface defined by conf.
587// If no configuration source is set, this method returns nil, nil.
588func (c RateLimiting) Fetcher(
589 ctx context.Context, blobConf BlobConfig, httpClientProvider httpclient.Provider,
590) (fetch.Interface, error) {
591 switch c.ConfigSource {
592 case "directory":
593 return fetch.FromFilesystem(c.Directory), nil
594 case "url":
595 httpClient, err := httpClientProvider.HTTPClient(ctx, httpclient.WithCache(true))
596 if err != nil {
597 return nil, err
598 }
599 return fetch.FromHTTP(httpClient, c.URL)
600 case "blob":
601 b, err := blobConf.Bucket(ctx, c.Blob.Bucket, httpClientProvider)
602 if err != nil {
603 return nil, err
604 }
605 return fetch.FromBucket(ctx, b, c.Blob.Path), nil
606 default:
607 return nil, nil
608 }
609}
610
611// MTLSAuthConfig contains the configuration for mTLS authentication.
612type MTLSAuthConfig struct {

Callers 3

NewFunction · 0.45
FrequencyPlansFetcherMethod · 0.45

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