aboutsummaryrefslogtreecommitdiffstats
path: root/lib/app.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-03-05 15:28:48 -0800
committerAdam Soltys <[email protected]>2024-03-05 15:28:48 -0800
commit2967b5994469ec83faba99135b696e4367cab67a (patch)
tree869d852efa19227c24b04bf6a4f45d54d4e11b7b /lib/app.js
parentc1641e80d3dc113e4adbc48c1bc8e54a5fd68f7c (diff)
downloadcoinos-server-2967b5994469ec83faba99135b696e4367cab67a.tar.gz
coinos-server-2967b5994469ec83faba99135b696e4367cab67a.zip
rate limiting
Diffstat (limited to 'lib/app.js')
-rw-r--r--lib/app.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/app.js b/lib/app.js
index 4c4b7326..c1006455 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -19,6 +19,12 @@ const app = fastify({
maxParamLength: 500,
});
+await app.register(import("@fastify/rate-limit"), {
+ max: 50,
+ timeWindow: 5000,
+ keyGenerator: (req) => req.headers["cf-connecting-ip"],
+});
+
app.register(fastifySecureSession, {
key: Buffer.from(config.jwt, "hex"),
});