Skip to content

Commit

Permalink
fix: remove sentry as required, its optional now
Browse files Browse the repository at this point in the history
  • Loading branch information
rubiin committed Aug 28, 2024
1 parent 636f625 commit ce02219
Show file tree
Hide file tree
Showing 8 changed files with 1,305 additions and 1,517 deletions.
8 changes: 0 additions & 8 deletions env/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,13 @@ REDIS_HOST=
REDIS_PORT=
REDIS_URI=

#REDIS_URI=


# rabbitmq
RABBITMQ_DEFAULT_USER=
RABBITMQ_DEFAULT_PASS=
RABBITMQ_EXCHANGE=
RABBITMQ_DEFAULT_PREFETCH=
RABBITMQ_URI=


#sentry
SENTRY_DSN=
SENTRY_ENVIRONMENT=

#google ouath
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
Expand Down
2 changes: 2 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ module.exports = rubiin({
"ignoreIIFE": true
}],
"unicorn/prefer-top-level-await": "off",
"ts/no-unsafe-assignment": "off",
"ts/no-unsafe-call": "off",
"unicorn/prevent-abbreviations": [
"error",
{
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ultimate-nest",
"version": "2.5.0",
"packageManager": "pnpm@9.8.0",
"packageManager": "pnpm@9.9.0",
"description": "NestJS + MikroORM blog example with batteries included",
"author": {
"email": "roobin.bhandari@gmail.com",
Expand Down Expand Up @@ -69,6 +69,7 @@
"@mikro-orm/postgresql": "6.3.6",
"@mikro-orm/reflection": "6.3.6",
"@mikro-orm/sql-highlighter": "^1.0.1",
"@nest-lab/throttler-storage-redis": "^1.0.0",
"@nestjs/axios": "^3.0.3",
"@nestjs/cache-manager": "^2.2.2",
"@nestjs/common": "10.4.1",
Expand Down Expand Up @@ -105,14 +106,13 @@
"helmet": "^7.1.0",
"helper-fns": "^2.7.0",
"ioredis": "^5.4.1",
"isomorphic-dompurify": "^2.14.0",
"isomorphic-dompurify": "^2.15.0",
"joi": "^17.13.3",
"mime-types": "^2.1.35",
"nestjs-cloudinary": "^2.0.7",
"nestjs-i18n": "^10.4.5",
"nestjs-minio": "^2.6.2",
"nestjs-pino": "^4.1.0",
"nestjs-throttler-storage-redis": "^0.5.0",
"nodemailer": "^6.9.14",
"otplib": "^12.0.1",
"passport": "0.7.0",
Expand All @@ -122,7 +122,7 @@
"passport-magic-login": "^1.2.2",
"pino-http": "^10.2.0",
"pino-pretty": "^11.2.2",
"poolifier": "^4.2.4",
"poolifier": "^4.2.5",
"preview-email": "^3.1.0",
"prom-client": "^15.1.3",
"qrcode": "^1.5.4",
Expand All @@ -138,7 +138,7 @@
"url-minify": "^2.8.4"
},
"devDependencies": {
"@antfu/eslint-config": "^2.27.1",
"@antfu/eslint-config": "^2.27.3",
"@firebase/app-compat": "^0.2.39",
"@firebase/app-types": "^0.9.2",
"@golevelup/ts-jest": "^0.5.4",
Expand All @@ -148,7 +148,7 @@
"@nestjs/schematics": "10.1.4",
"@nestjs/testing": "10.4.1",
"@rubiin/tsconfig": "^1.1.2",
"@sentry/types": "^8.26.0",
"@sentry/types": "^8.27.0",
"@side/jest-runtime": "^1.1.0",
"@swc/core": "^1.7.18",
"@swc/jest": "^0.2.36",
Expand Down
2,783 changes: 1,294 additions & 1,489 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/common/guards/throttle.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ export class CustomThrottlerGuard extends ThrottlerGuard {
protected errorMessage = THROTTLE_LIMIT_RESPONSE;

protected async getTracker(request: NestifyRequest): Promise<string> {
if (request.ips.length > 0 && request.ips[0])
if (request?.ips.length > 0 && request?.ips[0] != null)
return request.ips[0];
else if (request.ip)
else if (request?.ip != null)
return request.ip;

throw new Error("Unable to get IP address");
Expand Down
4 changes: 0 additions & 4 deletions src/lib/config/config.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import {
rabbitmqConfigValidationSchema,
redis,
redisConfigValidationSchema,
sentry,
sentryConfigurationValidationSchema,
throttle,
throttleConfigValidationSchema,
} from "./configs";
Expand All @@ -42,7 +40,6 @@ import {
googleOauth,
facebookOauth,
throttle,
sentry,
],
cache: true,
isGlobal: true,
Expand All @@ -57,7 +54,6 @@ import {
...googleOauthConfigValidationSchema,
...facebookOauthConfigValidationSchema,
...throttleConfigValidationSchema,
...sentryConfigurationValidationSchema,
}),
validationOptions: {
abortEarly: true,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/throttle.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Module } from "@nestjs/common";
import { ConfigModule, ConfigService } from "@nestjs/config";
import { ThrottlerModule } from "@nestjs/throttler";
import { ThrottlerStorageRedisService } from "nestjs-throttler-storage-redis";
import { ThrottlerStorageRedisService } from '@nest-lab/throttler-storage-redis';

@Module({
imports: [
Expand Down
7 changes: 0 additions & 7 deletions src/modules/shared/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ import {
NestJwtModule,
NestMailModule,
NestPinoModule,
NestSentryModule,
NestServeStaticModule,
NestThrottlerModule
} from "@lib/index";
import { Module } from "@nestjs/common";
import { APP_GUARD, APP_INTERCEPTOR } from "@nestjs/core";
import { ScheduleModule } from "@nestjs/schedule";
import { SentryInterceptor } from "@travelerdev/nestjs-sentry";

@Module({
imports: [
Expand All @@ -27,7 +25,6 @@ import { SentryInterceptor } from "@travelerdev/nestjs-sentry";
NestI18nModule,
NestCloudinaryModule,
NestCacheModule,
NestSentryModule,
NestCaslModule,
NestThrottlerModule,
NestHttpModule,
Expand All @@ -36,10 +33,6 @@ import { SentryInterceptor } from "@travelerdev/nestjs-sentry";
ScheduleModule.forRoot(),
],
providers: [
{
provide: APP_INTERCEPTOR,
useFactory: () => new SentryInterceptor(),
},
{
provide: APP_GUARD,
useClass: CustomThrottlerGuard,
Expand Down

0 comments on commit ce02219

Please sign in to comment.