Skip to content

Commit

Permalink
add config
Browse files Browse the repository at this point in the history
  • Loading branch information
liglig999 committed Apr 13, 2024
1 parent 685f23e commit 8b0b431
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions apps/auth/src/auth.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { MongooseModule } from '@nestjs/mongoose';
import { UsersService } from './users/users.service';
import { UserSchema } from './users/users.schema';
import { LoggerModule } from '@app/common';
import * as Joi form 'joi';
import { ConfigModule } from '@nestjs/config';

@Module({
imports: [
Expand All @@ -18,6 +20,13 @@ import { LoggerModule } from '@app/common';
secret: jwtConstants.secret,
signOptions: { expiresIn: '60s' },
}),
ConfigModule.forRoot({
isGlobal: true,
validationSchema: Joi.object({
MONGODB_URI: Joi.string().default('mongodb://admin:secret@mongodb/'),
MONGODB_DATABASE: Joi.string().default('auth'),
}),
}),
MongooseModule.forRoot(
'mongodb://admin:secret@mongodb/auth?authSource=admin',
),
Expand Down
1 change: 1 addition & 0 deletions apps/gateway/src/gateway.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { JwtModule } from '@nestjs/jwt';
import { jwtConstants } from 'apps/auth/src/auth.constants';
import { APP_GUARD } from '@nestjs/core';
import { AuthGuard } from '@app/common';
import { LoggerModule } from '@app/common';

@Module({
imports: [
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"bcrypt": "^5.1.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"joi": "^17.12.3",
"cookie-parser": "^1.4.6",
"express": "^4.19.2",
"mongoose": "^8.2.4",
Expand All @@ -52,6 +53,7 @@
"@nestjs/testing": "^10.0.0",
"@types/express": "^4.17.17",
"@types/jest": "^29.5.2",
"@types/joi": "^17.2.3",
"@types/node": "^20.3.1",
"@types/supertest": "^2.0.12",
"@typescript-eslint/eslint-plugin": "^6.0.0",
Expand Down

0 comments on commit 8b0b431

Please sign in to comment.