mirror of
https://github.com/9technologygroup/patchmon.net.git
synced 2025-10-22 23:32:03 +00:00
Merge pull request #208 from PatchMon/post1-3-0
Fixed some ratelimits that were hardcoded and ammended docker compose…
This commit is contained in:
@@ -295,7 +295,7 @@ app.disable("x-powered-by");
|
|||||||
// Rate limiting with monitoring
|
// Rate limiting with monitoring
|
||||||
const limiter = rateLimit({
|
const limiter = rateLimit({
|
||||||
windowMs: parseInt(process.env.RATE_LIMIT_WINDOW_MS, 10) || 15 * 60 * 1000,
|
windowMs: parseInt(process.env.RATE_LIMIT_WINDOW_MS, 10) || 15 * 60 * 1000,
|
||||||
max: parseInt(process.env.RATE_LIMIT_MAX, 10) || 100,
|
max: parseInt(process.env.RATE_LIMIT_MAX, 10) || 5000,
|
||||||
message: {
|
message: {
|
||||||
error: "Too many requests from this IP, please try again later.",
|
error: "Too many requests from this IP, please try again later.",
|
||||||
retryAfter: Math.ceil(
|
retryAfter: Math.ceil(
|
||||||
@@ -424,7 +424,7 @@ const apiVersion = process.env.API_VERSION || "v1";
|
|||||||
const authLimiter = rateLimit({
|
const authLimiter = rateLimit({
|
||||||
windowMs:
|
windowMs:
|
||||||
parseInt(process.env.AUTH_RATE_LIMIT_WINDOW_MS, 10) || 10 * 60 * 1000,
|
parseInt(process.env.AUTH_RATE_LIMIT_WINDOW_MS, 10) || 10 * 60 * 1000,
|
||||||
max: parseInt(process.env.AUTH_RATE_LIMIT_MAX, 10) || 20,
|
max: parseInt(process.env.AUTH_RATE_LIMIT_MAX, 10) || 500,
|
||||||
message: {
|
message: {
|
||||||
error: "Too many authentication requests, please try again later.",
|
error: "Too many authentication requests, please try again later.",
|
||||||
retryAfter: Math.ceil(
|
retryAfter: Math.ceil(
|
||||||
@@ -438,7 +438,7 @@ const authLimiter = rateLimit({
|
|||||||
});
|
});
|
||||||
const agentLimiter = rateLimit({
|
const agentLimiter = rateLimit({
|
||||||
windowMs: parseInt(process.env.AGENT_RATE_LIMIT_WINDOW_MS, 10) || 60 * 1000,
|
windowMs: parseInt(process.env.AGENT_RATE_LIMIT_WINDOW_MS, 10) || 60 * 1000,
|
||||||
max: parseInt(process.env.AGENT_RATE_LIMIT_MAX, 10) || 120,
|
max: parseInt(process.env.AGENT_RATE_LIMIT_MAX, 10) || 1000,
|
||||||
message: {
|
message: {
|
||||||
error: "Too many agent requests, please try again later.",
|
error: "Too many agent requests, please try again later.",
|
||||||
retryAfter: Math.ceil(
|
retryAfter: Math.ceil(
|
||||||
|
@@ -50,6 +50,13 @@ services:
|
|||||||
SERVER_HOST: localhost
|
SERVER_HOST: localhost
|
||||||
SERVER_PORT: 3000
|
SERVER_PORT: 3000
|
||||||
CORS_ORIGIN: http://localhost:3000
|
CORS_ORIGIN: http://localhost:3000
|
||||||
|
# Rate Limiting (times in milliseconds)
|
||||||
|
RATE_LIMIT_WINDOW_MS: 900000
|
||||||
|
RATE_LIMIT_MAX: 5000
|
||||||
|
AUTH_RATE_LIMIT_WINDOW_MS: 600000
|
||||||
|
AUTH_RATE_LIMIT_MAX: 500
|
||||||
|
AGENT_RATE_LIMIT_WINDOW_MS: 60000
|
||||||
|
AGENT_RATE_LIMIT_MAX: 1000
|
||||||
# Redis Configuration
|
# Redis Configuration
|
||||||
REDIS_HOST: redis
|
REDIS_HOST: redis
|
||||||
REDIS_PORT: 6379
|
REDIS_PORT: 6379
|
||||||
|
@@ -56,6 +56,13 @@ services:
|
|||||||
SERVER_HOST: localhost
|
SERVER_HOST: localhost
|
||||||
SERVER_PORT: 3000
|
SERVER_PORT: 3000
|
||||||
CORS_ORIGIN: http://localhost:3000
|
CORS_ORIGIN: http://localhost:3000
|
||||||
|
# Rate Limiting (times in milliseconds)
|
||||||
|
RATE_LIMIT_WINDOW_MS: 900000
|
||||||
|
RATE_LIMIT_MAX: 5000
|
||||||
|
AUTH_RATE_LIMIT_WINDOW_MS: 600000
|
||||||
|
AUTH_RATE_LIMIT_MAX: 500
|
||||||
|
AGENT_RATE_LIMIT_WINDOW_MS: 60000
|
||||||
|
AGENT_RATE_LIMIT_MAX: 1000
|
||||||
# Redis Configuration
|
# Redis Configuration
|
||||||
REDIS_HOST: redis
|
REDIS_HOST: redis
|
||||||
REDIS_PORT: 6379
|
REDIS_PORT: 6379
|
||||||
|
Reference in New Issue
Block a user