Add "http-timeout" CLI flag.

This allows for an override of the default HTTP timeout for library HTTP requests.
Fixes #207.
This commit is contained in:
xenolf 2016-05-19 18:52:44 +02:00
parent 9e0c21c439
commit b119bc45fb
2 changed files with 9 additions and 0 deletions

4
cli.go
View file

@ -146,6 +146,10 @@ func main() {
Name: "dns",
Usage: "Solve a DNS challenge using the specified provider. Disables all other challenges. Run 'lego dnshelp' for help on usage.",
},
cli.IntFlag{
Name: "http-timeout",
Usage: "Set the HTTP timeout value to a specific value in seconds. The default is 10 seconds.",
},
}
err = app.Run(os.Args)

View file

@ -32,6 +32,11 @@ func checkFolder(path string) error {
}
func setup(c *cli.Context) (*Configuration, *Account, *acme.Client) {
if c.GlobalIsSet("http-timeout") {
acme.HTTPTimeout = time.Duration(c.GlobalInt("http-timeout")) * time.Second
}
err := checkFolder(c.GlobalString("path"))
if err != nil {
logger().Fatalf("Could not check/create path: %s", err.Error())