mirror of
https://github.com/httpjamesm/AnonymousOverflow.git
synced 2025-04-20 13:59:16 +00:00
feat: DISABLE_RATELIMIT env
This commit is contained in:
parent
487a62e7aa
commit
6b77c5dae4
2 changed files with 7 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue