mirror of
https://github.com/yanislav-igonin/micrach
synced 2024-12-22 14:22:33 +03:00
change limiter enabling
This commit is contained in:
parent
0853d87fc3
commit
79c350c2fb
20
main.go
20
main.go
@ -49,15 +49,17 @@ func main() {
|
|||||||
app := fiber.New(fiber.Config{Views: engine})
|
app := fiber.New(fiber.Config{Views: engine})
|
||||||
|
|
||||||
app.Use(recover.New())
|
app.Use(recover.New())
|
||||||
app.Use(limiter.New(limiter.Config{
|
if config.App.IsRateLimiterEnabled {
|
||||||
Next: func(c *fiber.Ctx) bool {
|
app.Use(limiter.New(limiter.Config{
|
||||||
isDev := c.IsFromLocal()
|
Next: func(c *fiber.Ctx) bool {
|
||||||
path := c.Path()
|
isDev := c.IsFromLocal()
|
||||||
isRequestForStatic := strings.Contains(path, "/static") || strings.Contains(path, "/uploads") || strings.Contains(path, "/captcha")
|
path := c.Path()
|
||||||
return (isRequestForStatic || isDev) && config.App.IsRateLimiterEnabled
|
isRequestForStatic := strings.Contains(path, "/static") || strings.Contains(path, "/uploads") || strings.Contains(path, "/captcha")
|
||||||
},
|
return isRequestForStatic || isDev
|
||||||
Max: 50,
|
},
|
||||||
}))
|
Max: 50,
|
||||||
|
}))
|
||||||
|
}
|
||||||
app.Use(compress.New())
|
app.Use(compress.New())
|
||||||
|
|
||||||
app.Static("/uploads", "./uploads")
|
app.Static("/uploads", "./uploads")
|
||||||
|
Loading…
Reference in New Issue
Block a user