diff --git a/backend/config.test.toml b/backend/config.test.toml index 1c7b6fa..561c3d4 100644 --- a/backend/config.test.toml +++ b/backend/config.test.toml @@ -9,7 +9,7 @@ BaseURI = "http://localhost:8080" Token = "" [Http] -Port = 8080 +Port = 18080 [Http.Cors] Mode = "dev" @@ -21,16 +21,29 @@ AllowMethods = "GET,POST,PUT,PATCH,DELETE,OPTIONS" ExposeHeaders = "*" AllowCredentials = true +[Http.RateLimit] +Enabled = true +Max = 5 +WindowSeconds = 10 +Message = "Too Many Requests" + +[Http.RateLimit.Redis] +Addrs = ["127.0.0.1:6379"] +Username = "" +Password = "testpass" +DB = 2 +Prefix = "rl:" + [Database] -Host = "127.0.0.1" -Port = 5432 -Database = "quyun_v2_test" +Host = "10.1.1.2" +Port = 5433 +Database = "quyun_v2" Username = "postgres" -Password = "postgres" +Password = "xixi0202" SslMode = "disable" TimeZone = "Asia/Shanghai" MaxIdleConns = 10 -MaxOpenConns = 20 +MaxOpenConns = 100 ConnMaxLifetime = "1800s" ConnMaxIdleTime = "300s" diff --git a/docs/rate_limit_redis.md b/docs/rate_limit_redis.md index 692f5cc..5e2fa7c 100644 --- a/docs/rate_limit_redis.md +++ b/docs/rate_limit_redis.md @@ -17,6 +17,9 @@ sudo -n docker run -d --name quyun-redis -p 6379:6379 docker.hub.ipao.vip/redis: ## Config sample ```toml +[Http] +Port = 18080 # 如果 8080 被占用,可调整端口 + [Http.RateLimit] Enabled = true Max = 120