Skip to content

Commit

Permalink
fix: ratelimiting
Browse files Browse the repository at this point in the history
  • Loading branch information
Govind Diwakar committed Nov 6, 2023
1 parent caeb629 commit 30bfede
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions packages/medusa-plugin-strapi-ts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ const strapiOptions =
auto_start?: boolean; - starts the interface automatically along with medusa, not recommended as the medusa server may not be ready to sync as soon as strapi is ready
max_page_size?: number;

##### advanced environemental options
STAPI_HOOKS_MAX_REQUESTS - number of requests before hooks ratelimit kicksin
STAPI_HOOKS_MAX_DELAY - number of requests before hooks ratelimit window


## Using Strapi Plugin

Expand Down
2 changes: 1 addition & 1 deletion packages/medusa-plugin-strapi-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-strapi-ts",
"version": "5.0.16",
"version": "5.0.17",
"description": "A plugin for medusa to use strapi in the backend as the cms in typescript",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import strapiSignal from '../../controllers/hooks/strapi-signal';
import rateLimiter from 'express-rate-limit';

const limiter = rateLimiter({
max: 5,
windowMs: 10000, // 10 seconds
max: parseInt(process.env.STAPI_HOOKS_MAX_REQUESTS ?? '100') || 100,
windowMs: parseInt(process.env.STAPI_HOOKS_MAX_DELAY ?? '100000') || 100000, // 100 seconds
message: "You can't make any more requests at the moment. Try again later",
});
const hooksRouter = Router();
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19413,7 +19413,7 @@ medusa-interfaces@^1.3.7, [email protected]:
integrity sha512-vU1PjepGeglUmEqoBY72gx5Pfj5Uv3VCO3oqYpj6hSz55jhy4xnUNhf4Ttw1mhqGmwtyi9UkHx+aTuCcYx24Ww==

"medusa-plugin-strapi-ts@file:/home/ec2-user/hercules/public-plugins/medusa-strapi-repo/packages/medusa-plugin-strapi-ts":
version "5.0.16"
version "5.0.17"
resolved "file:packages/medusa-plugin-strapi-ts"
dependencies:
"@types/bcrypt" "^5.0.0"
Expand Down

0 comments on commit 30bfede

Please sign in to comment.