Implement rate limiting option, fixes #71

This commit is contained in:
Remco
2017-03-28 17:08:34 +02:00
parent 989debecb5
commit 2f35235865
3 changed files with 43 additions and 17 deletions

View File

@ -95,6 +95,12 @@ var globalFlags = []cli.Flag{
Value: "",
EnvVar: "BUCKET",
},
cli.IntFlag{
Name: "rate-limit",
Usage: "requests per minute",
Value: 0,
EnvVar: "",
},
cli.StringFlag{
Name: "lets-encrypt-hosts",
Usage: "host1, host2",
@ -190,6 +196,10 @@ func New() *Cmd {
options = append(options, server.ClamavHost(v))
}
if v := c.Int("rate-limit"); v > 0 {
options = append(options, server.RateLimit(v))
}
if cert := c.String("tls-cert-file"); cert == "" {
} else if pk := c.String("tls-private-key"); pk == "" {
} else {