Skip to content

Commit f31448c

Browse files
committed
Add support for network proxy configuration
1 parent 63eb9fe commit f31448c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cli/cli.go

+9
Original file line numberDiff line numberDiff line change
@@ -259,5 +259,14 @@ func preRun(cmd *cobra.Command, args []string) {
259259
netConf := downloader.Config{
260260
RequestHeaders: globals.NewHTTPClientHeader(),
261261
}
262+
if viper.IsSet("network.proxy") {
263+
proxy := viper.GetString("network.proxy")
264+
if _, err := url.Parse(proxy); err != nil {
265+
feedback.Error("Invalid network.proxy '" + proxy + "': " + err.Error())
266+
os.Exit(errorcodes.ErrBadArgument)
267+
}
268+
netConf.ProxyURL = proxy
269+
logrus.Infof("Using proxy %s", proxy)
270+
}
262271
downloader.SetDefaultConfig(netConf)
263272
}

0 commit comments

Comments
 (0)