@@ -93,6 +93,7 @@ type Repository struct {
9393 Username string
9494 Password string
9595 Token string // For Bearer
96+ Insecure bool
9697
9798 dir string // Root directory for this VEX repository, $CACHE_DIR/vex/repositories/$REPO_NAME/
9899}
@@ -164,7 +165,9 @@ func (r *Repository) downloadManifest(ctx context.Context, opts Options) error {
164165
165166 log .DebugContext (ctx , "Downloading the repository metadata..." , log .String ("url" , u .String ()), log .String ("dst" , r .dir ))
166167 _ , err = downloader .Download (ctx , u .String (), filepath .Join (r .dir , manifestFile ), "." , downloader.Options {
167- Insecure : opts .Insecure ,
168+ // if one between global and per-repo insecure option is set,
169+ // we set it to true accordingly
170+ Insecure : opts .Insecure || r .Insecure ,
168171 Auth : downloader.Auth {
169172 Username : r .Username ,
170173 Password : r .Password ,
@@ -239,8 +242,11 @@ func (r *Repository) download(ctx context.Context, ver Version, dst string, opts
239242 logger := log .With (log .String ("repo" , r .Name ))
240243 logger .DebugContext (ctx , "Downloading repository to cache dir..." , log .String ("url" , loc .URL ),
241244 log .String ("dir" , dst ), log .String ("etag" , etags [loc .URL ]))
245+
242246 etag , err := downloader .Download (ctx , loc .URL , dst , "." , downloader.Options {
243- Insecure : opts .Insecure ,
247+ // if one between global and per-repo insecure option is set,
248+ // we set it to true accordingly
249+ Insecure : opts .Insecure || r .Insecure ,
244250 Auth : downloader.Auth {
245251 Username : r .Username ,
246252 Password : r .Password ,
0 commit comments