diff --git a/pkg/getter/getter.go b/pkg/getter/getter.go index e11dbfcae..b545c1e1f 100644 --- a/pkg/getter/getter.go +++ b/pkg/getter/getter.go @@ -35,6 +35,7 @@ type options struct { username string password string userAgent string + cachePath string } // Option allows specifying various settings configurable by the user for overriding the defaults @@ -73,6 +74,14 @@ func WithTLSClientConfig(certFile, keyFile, caFile string) Option { } } +// WithCache will wrap all HTTP requests through the local file system cache. +// Charts are cached in a flat structure with name equal to the chart digest. +func WithCache(digest string) Option { + return func(opts *options) { + opts.cachePath = path.Join(helmpath.ChartCachePath(), digest) // new? + } +} + // Getter is an interface to support GET to the specified URL. type Getter interface { // Get file content by url string