feat: DISABLE_RATELIMIT env
This commit is contained in:
parent
487a62e7aa
commit
6b77c5dae4
@ -1,3 +1,3 @@
|
||||
package config
|
||||
|
||||
var Version = "1.8"
|
||||
var Version = "1.8.1"
|
||||
|
@ -2,6 +2,7 @@ package middleware
|
||||
|
||||
import (
|
||||
"anonymousoverflow/config"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
@ -14,6 +15,11 @@ var ipMap = sync.Map{}
|
||||
func Ratelimit() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
|
||||
if os.Getenv("DISABLE_RATELIMIT") == "true" {
|
||||
c.Next()
|
||||
return
|
||||
}
|
||||
|
||||
if strings.HasPrefix(c.Request.URL.Path, "/static") {
|
||||
c.Next()
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user