Skip to content

Commit

Permalink
[BE - #64] redis 연결 세팅 (#65)
Browse files Browse the repository at this point in the history
* chore: @types/ioredis 설치

* feat: redis 연결 설정
  • Loading branch information
nowChae authored Nov 14, 2024
1 parent 056cc41 commit 7f717d5
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 13 deletions.
17 changes: 14 additions & 3 deletions .pnp.cjs

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

Binary file not shown.
1 change: 1 addition & 0 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"devDependencies": {
"@nestjs/testing": "^10.4.6",
"@types/express": "^5.0.0",
"@types/ioredis": "^5.0.0",
"@types/jest": "^29.5.14",
"@types/node": "^22.8.7",
"@types/supertest": "^6.0.2",
Expand Down
20 changes: 12 additions & 8 deletions packages/server/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { TypeOrmModuleOptions } from '@nestjs/typeorm';
import { UserModule } from './module/user/user.module';
import { QuizModule } from './module/quiz/quiz.module';
import { GameGateway } from './module/game/game.gateway';
import { ClientsModule, Transport } from '@nestjs/microservices';

@Module({
imports: [
Expand All @@ -31,14 +32,17 @@ import { GameGateway } from './module/game/game.gateway';
autoLoadEntities: configService.get<boolean>('mysql.autoLoadEntities'),
}),
}),
// Redis 설정
// RedisModule.forRoot({
// type: 'single',
// options: {
// host: redisConfig.host,
// port: redisConfig.port,
// }
// }),
ClientsModule.register([
{
name: 'REDIS_SERVICE',
transport: Transport.REDIS,
options: {
host: redisConfig.host,
port: redisConfig.port,
password: redisConfig.password,
},
},
]),
],
controllers: [AppController],
providers: [AppService, GameGateway],
Expand Down
4 changes: 3 additions & 1 deletion packages/server/src/config/database/redis/redis.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
export interface RedisConfig {
host: string;
port: number;
password: string;
}

export const redisConfig: RedisConfig = {
host: process.env.REDIS_HOST || 'localhost',
port: Number(process.env.REDIS_PORT) || 6379,
};
password: process.env.REDIS_PASSWORD,
};
12 changes: 11 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2779,6 +2779,15 @@ __metadata:
languageName: node
linkType: hard

"@types/ioredis@npm:^5.0.0":
version: 5.0.0
resolution: "@types/ioredis@npm:5.0.0"
dependencies:
ioredis: "npm:*"
checksum: 10c0/e52ce4239f0334701fc95fb5aaf1753d75f7582099fdf152743192f49d9ee4a88478b339d015e50cb5e111e38925846cf20668355f4046af7855021d2be181f0
languageName: node
linkType: hard

"@types/istanbul-lib-coverage@npm:*, @types/istanbul-lib-coverage@npm:^2.0.0, @types/istanbul-lib-coverage@npm:^2.0.1":
version: 2.0.6
resolution: "@types/istanbul-lib-coverage@npm:2.0.6"
Expand Down Expand Up @@ -6493,7 +6502,7 @@ __metadata:
languageName: node
linkType: hard

"ioredis@npm:^5.4.1":
"ioredis@npm:*, ioredis@npm:^5.4.1":
version: 5.4.1
resolution: "ioredis@npm:5.4.1"
dependencies:
Expand Down Expand Up @@ -9334,6 +9343,7 @@ __metadata:
"@nestjs/typeorm": "npm:^10.0.2"
"@nestjs/websockets": "npm:^10.4.7"
"@types/express": "npm:^5.0.0"
"@types/ioredis": "npm:^5.0.0"
"@types/jest": "npm:^29.5.14"
"@types/joi": "npm:^17.2.3"
"@types/node": "npm:^22.8.7"
Expand Down

0 comments on commit 7f717d5

Please sign in to comment.