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:
parent
9e0c21c439
commit
b119bc45fb
2 changed files with 9 additions and 0 deletions
4
cli.go
4
cli.go
|
@ -146,6 +146,10 @@ func main() {
|
||||||
Name: "dns",
|
Name: "dns",
|
||||||
Usage: "Solve a DNS challenge using the specified provider. Disables all other challenges. Run 'lego dnshelp' for help on usage.",
|
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)
|
err = app.Run(os.Args)
|
||||||
|
|
|
@ -32,6 +32,11 @@ func checkFolder(path string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func setup(c *cli.Context) (*Configuration, *Account, *acme.Client) {
|
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"))
|
err := checkFolder(c.GlobalString("path"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger().Fatalf("Could not check/create path: %s", err.Error())
|
logger().Fatalf("Could not check/create path: %s", err.Error())
|
||||||
|
|
Loading…
Reference in a new issue