@@ -26,6 +26,7 @@ import (
2626 "net/http"
2727 "net/url"
2828 "os"
29+ "strings"
2930
3031 "github.com/hashicorp/go-retryablehttp"
3132 digestlib "github.com/opencontainers/go-digest"
@@ -37,8 +38,13 @@ import (
3738const (
3839 // envSourceControllerLocalhost is the name of the environment variable
3940 // used to override the hostname of the source-controller from which
40- // the chart is usually downloaded.
41+ // the chart is downloaded.
4142 envSourceControllerLocalhost = "SOURCE_CONTROLLER_LOCALHOST"
43+
44+ // envSourceWatcherLocalhost is the name of the environment variable
45+ // used to override the hostname of the source-watcher from which
46+ // the chart is downloaded.
47+ envSourceWatcherLocalhost = "SOURCE_WATCHER_LOCALHOST"
4248)
4349
4450var (
5460// digest before loading the chart. It returns the loaded chart.Chart, or an
5561// error. The error may be of type ErrIntegrity if the integrity check fails.
5662func SecureLoadChartFromURL (client * retryablehttp.Client , URL , digest string ) (* chart.Chart , error ) {
57- URL , err := overwriteHostname (URL , os .Getenv (envSourceControllerLocalhost ))
63+ envSourceLocalhost := os .Getenv (envSourceControllerLocalhost )
64+ if strings .Contains (URL , "//source-watcher" ) {
65+ envSourceLocalhost = os .Getenv (envSourceWatcherLocalhost )
66+ }
67+
68+ URL , err := overwriteHostname (URL , envSourceLocalhost )
5869 if err != nil {
5970 return nil , err
6071 }
0 commit comments