Skip to content

Commit 3b4c4e2

Browse files
committed
Add support for network proxy configuration
1 parent 464dbb5 commit 3b4c4e2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cli/cli.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,5 +263,14 @@ func preRun(cmd *cobra.Command, args []string) {
263263
netConf := downloader.Config{
264264
RequestHeaders: globals.NewHTTPClientHeader(),
265265
}
266+
if viper.IsSet("network.proxy") {
267+
proxy := viper.GetString("network.proxy")
268+
if _, err := url.Parse(proxy); err != nil {
269+
feedback.Error("Invalid network.proxy '" + proxy + "': " + err.Error())
270+
os.Exit(errorcodes.ErrBadArgument)
271+
}
272+
netConf.ProxyURL = proxy
273+
logrus.Infof("Using proxy %s", proxy)
274+
}
266275
downloader.SetDefaultConfig(netConf)
267276
}

0 commit comments

Comments
 (0)