rate limiter now enabled from config

This commit is contained in:
Yanislav Igonin 2022-05-18 10:34:56 +03:00
parent 965dc59ffc
commit 0853d87fc3
2 changed files with 2 additions and 2 deletions

View File

@ -54,7 +54,7 @@ func main() {
isDev := c.IsFromLocal()
path := c.Path()
isRequestForStatic := strings.Contains(path, "/static") || strings.Contains(path, "/uploads") || strings.Contains(path, "/captcha")
return isRequestForStatic || isDev
return (isRequestForStatic || isDev) && config.App.IsRateLimiterEnabled
},
Max: 50,
}))

View File

@ -1,4 +1,4 @@
echo "GET http://localhost:3000" | vegeta attack -rate 100 -duration=120s | tee results.bin | vegeta report
echo "GET http://micrach.igonin.dev" | vegeta attack -rate 100 -duration=120s | tee results.bin | vegeta report
# vegeta report -type=json results.bin > metrics.json
cat results.bin | vegeta plot > plot.html
open plot.html