summary refs log tree commit diff
path: root/src/Server.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-12 18:57:25 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-12 18:57:25 +0200
commit202cc248119fc369a43fb6e1a91c8023dc69041e (patch)
treea0e0007c581b6198e22908f0c706e98535b3e498 /src/Server.ts
parent:bug: fix rabbit mq -> fanout instead of work queue (diff)
downloadserver-202cc248119fc369a43fb6e1a91c8023dc69041e.tar.xz
:sparkles: rate limit now configurable in the config
Diffstat (limited to '')
-rw-r--r--src/Server.ts8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/Server.ts b/src/Server.ts

index 3e20695a..7299425a 100644 --- a/src/Server.ts +++ b/src/Server.ts
@@ -12,7 +12,7 @@ import { BodyParser } from "./middlewares/BodyParser"; import express, { Router, Request, Response } from "express"; import mongoose from "mongoose"; import path from "path"; -import RateLimit from "./middlewares/RateLimit"; +import { initRateLimits } from "./middlewares/RateLimit"; import TestClient from "./middlewares/TestClient"; // this will return the new updated document for findOneAndUpdate @@ -86,12 +86,8 @@ export class FosscordServer extends Server { const api = Router(); // @ts-ignore this.app = api; - api.use(RateLimit({ bucket: "global", count: 10, window: 5, bot: 250 })); - api.use(RateLimit({ bucket: "error", count: 5, error: true, window: 5, bot: 15, onlyIp: true })); - api.use("/guilds/:id", RateLimit({ count: 5, window: 5 })); - api.use("/webhooks/:id", RateLimit({ count: 5, window: 5 })); - api.use("/channels/:id", RateLimit({ count: 5, window: 5 })); + initRateLimits(api); this.routes = await this.registerRoutes(path.join(__dirname, "routes", "/")); app.use("/api/v8", api); app.use("/api/v9", api);