Skip to content

Commit db4513e

Browse files
committed
Add httpsProxy variable
1 parent db3ef29 commit db4513e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

main.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ var (
4949
indexURL = flag.String("indexURL", "https://downloads.arduino.cc/packages/package_staging_index.json", "The address from where to download the index json containing the location of upload tools")
5050
requiredToolsAPILevel = "v1"
5151
httpProxy = flag.String("httpProxy", "", "Proxy server for HTTP requests")
52+
httpsProxy = flag.String("httpsProxy", "", "Proxy server for HTTPS requests")
5253
)
5354

5455
type NullWriter int
@@ -141,6 +142,17 @@ func main() {
141142
}
142143
}
143144

145+
if *httpsProxy != "" {
146+
log.Printf("Setting HTTPS_PROXY variable to %v", *httpProxy)
147+
err := os.Setenv("HTTPS_PROXY", *httpProxy)
148+
if err != nil {
149+
// The os.Setenv documentation doesn't specify how it can
150+
// fail, so I don't know how to handle this error
151+
// appropriately.
152+
panic(err)
153+
}
154+
}
155+
144156
// move CORS to config file compatibility, Vagrant version
145157
if *origins == "" {
146158
log.Println("Patching config.ini for compatibility")

0 commit comments

Comments
 (0)