Skip to content

Commit

Permalink
feat(auth): upgraded @nestjs/throttler to v5
Browse files Browse the repository at this point in the history
undefined
  • Loading branch information
ZenSoftware committed Sep 29, 2023
1 parent da3c7e0 commit 6de92f8
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion apps/api/src/app/graphql/resolvers/Auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const typeDefs = gql`

@Resolver()
@UseGuards(GqlThrottlerGuard)
@Throttle()
@Throttle({ default: { limit: 5, ttl: 30_000 } })
export class AuthResolver {
constructor(
private readonly auth: AuthService,
Expand Down
8 changes: 6 additions & 2 deletions apps/api/src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,13 @@ export const environment: EnvironmentBase = {
},
},
throttle: {
limit: 10,
ttl: 60,
ignoreUserAgents: [/googlebot/gi, /bingbot/gi],
throttlers: [
{
limit: 2,
ttl: 60_000,
},
],
},
bcryptCost: 12,
oauth: {
Expand Down
8 changes: 6 additions & 2 deletions apps/api/src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,13 @@ export const environment: EnvironmentBase = {
},
},
throttle: {
limit: 2,
ttl: 60,
ignoreUserAgents: [/googlebot/gi, /bingbot/gi],
throttlers: [
{
limit: 5,
ttl: 30_000,
},
],
},
bcryptCost: 12,
oauth: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@nestjs/jwt": "^10.1.1",
"@nestjs/passport": "^10.0.2",
"@nestjs/platform-express": "^10.2.6",
"@nestjs/throttler": "^4.2.1",
"@nestjs/throttler": "^5.0.0",
"@paljs/plugins": "6.0.7",
"@prisma/client": "~5.3.1",
"class-transformer": "^0.5.1",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

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

0 comments on commit 6de92f8

Please sign in to comment.