From dc073b9c32d0046c18c6bbfd3f2bdcd374c84af0 Mon Sep 17 00:00:00 2001 From: bitgully <32452884+bitgully@users.noreply.github.com> Date: Sun, 3 Mar 2024 19:18:20 +0100 Subject: [PATCH] mirror functionality added to docs --- dependency_cache.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/dependency_cache.go b/dependency_cache.go index 56a666f..3d7bb55 100644 --- a/dependency_cache.go +++ b/dependency_cache.go @@ -47,8 +47,8 @@ type HttpClientTimeouts struct { ExpectContinueTimeout time.Duration } -// DependencyCache allows a user to get an artifact either from a buildpack's cache, a previous download, or to download -// directly. +// DependencyCache allows a user to get an artifact either from a buildpack's cache, a previous download, +// a mirror registry, or to download directly. type DependencyCache struct { // CachePath is the location where the buildpack has cached its dependencies. @@ -75,7 +75,13 @@ type DependencyCache struct { // NewDependencyCache creates a new instance setting the default cache path (/dependencies) and user // agent (/). -// Mappings will be read from any libcnb.Binding in the context with type "dependency-mappings" +// Mappings will be read from any libcnb.Binding in the context with type "dependency-mappings". +// +// If dependencies should not be downloaded directly, but need to be pulled from a mirror registry (e.g. in air-gapped environments), +// the alternative URI can either be provided as environment variable "BP_DEPENDENCY_MIRROR", or by a binding of type "dependency-mirror" +// where a file named "uri" must provide the desired location. +// The two schemes https:// and file:// are supported in mirror URIs where the expected format is (parts in "[]"" are optional): +// ://[:@][:][/] func NewDependencyCache(context libcnb.BuildContext) (DependencyCache, error) { cache := DependencyCache{ CachePath: filepath.Join(context.Buildpack.Path, "dependencies"),