From 7f717d5bbf787d0ae9150015c17e39703e15af5c Mon Sep 17 00:00:00 2001 From: nowChae <99425616+nowChae@users.noreply.github.com> Date: Thu, 14 Nov 2024 15:52:19 +0900 Subject: [PATCH] =?UTF-8?q?[BE=20-=20#64]=20redis=20=EC=97=B0=EA=B2=B0=20?= =?UTF-8?q?=EC=84=B8=ED=8C=85=20(#65)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: @types/ioredis 설치 * feat: redis 연결 설정 --- .pnp.cjs | 17 ++++++++++++--- ...oredis-npm-5.0.0-6efa70abfa-e52ce4239f.zip | Bin 0 -> 2552 bytes packages/server/package.json | 1 + packages/server/src/app.module.ts | 20 +++++++++++------- .../src/config/database/redis/redis.config.ts | 4 +++- yarn.lock | 12 ++++++++++- 6 files changed, 41 insertions(+), 13 deletions(-) create mode 100644 .yarn/cache/@types-ioredis-npm-5.0.0-6efa70abfa-e52ce4239f.zip diff --git a/.pnp.cjs b/.pnp.cjs index 7708aa80..90b41a00 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -2138,7 +2138,7 @@ const RAW_RUNTIME_STATE = ["@nestjs/common", "virtual:2499dbb93d824027565d71b0716c4fb8b548ad61955d0a0286bfb3c5b4058e227894b6691d96808c00f576db14870018375210362c26ee321ea99fd6ed041c74#npm:10.4.6"],\ ["@nestjs/core", "virtual:2499dbb93d824027565d71b0716c4fb8b548ad61955d0a0286bfb3c5b4058e227894b6691d96808c00f576db14870018375210362c26ee321ea99fd6ed041c74#npm:10.4.6"],\ ["@nestjs/terminus", "virtual:ef3947e1416be14da271f1cea11b029acb8045f9552026e50d3639fb92e54fc3d7c48c13e8766466450a1b27c5c4d49cdf5d9b91125d082edca72ef653c93e1f#npm:10.2.0"],\ - ["@types/ioredis", null],\ + ["@types/ioredis", "npm:5.0.0"],\ ["@types/nestjs__common", null],\ ["@types/nestjs__core", null],\ ["ioredis", "npm:5.4.1"]\ @@ -2333,7 +2333,7 @@ const RAW_RUNTIME_STATE = ["@types/amqplib", null],\ ["@types/cache-manager", null],\ ["@types/grpc__grpc-js", null],\ - ["@types/ioredis", null],\ + ["@types/ioredis", "npm:5.0.0"],\ ["@types/kafkajs", null],\ ["@types/mqtt", null],\ ["@types/nats", null],\ @@ -4536,6 +4536,16 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ + ["@types/ioredis", [\ + ["npm:5.0.0", {\ + "packageLocation": "./.yarn/cache/@types-ioredis-npm-5.0.0-6efa70abfa-e52ce4239f.zip/node_modules/@types/ioredis/",\ + "packageDependencies": [\ + ["@types/ioredis", "npm:5.0.0"],\ + ["ioredis", "npm:5.4.1"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["@types/istanbul-lib-coverage", [\ ["npm:2.0.6", {\ "packageLocation": "./.yarn/cache/@types-istanbul-lib-coverage-npm-2.0.6-2ea31fda9c-3948088654.zip/node_modules/@types/istanbul-lib-coverage/",\ @@ -12341,6 +12351,7 @@ const RAW_RUNTIME_STATE = ["@nestjs/typeorm", "virtual:2499dbb93d824027565d71b0716c4fb8b548ad61955d0a0286bfb3c5b4058e227894b6691d96808c00f576db14870018375210362c26ee321ea99fd6ed041c74#npm:10.0.2"],\ ["@nestjs/websockets", "virtual:2499dbb93d824027565d71b0716c4fb8b548ad61955d0a0286bfb3c5b4058e227894b6691d96808c00f576db14870018375210362c26ee321ea99fd6ed041c74#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"],\ @@ -13547,7 +13558,7 @@ const RAW_RUNTIME_STATE = ["@types/better-sqlite3", null],\ ["@types/google-cloud__spanner", null],\ ["@types/hdb-pool", null],\ - ["@types/ioredis", null],\ + ["@types/ioredis", "npm:5.0.0"],\ ["@types/mongodb", null],\ ["@types/mssql", null],\ ["@types/mysql2", null],\ diff --git a/.yarn/cache/@types-ioredis-npm-5.0.0-6efa70abfa-e52ce4239f.zip b/.yarn/cache/@types-ioredis-npm-5.0.0-6efa70abfa-e52ce4239f.zip new file mode 100644 index 0000000000000000000000000000000000000000..df27c04b41b11f10cd05769cac8a41a8da520f33 GIT binary patch literal 2552 zcmbVO&2HO95LW6WC=3+np~oI342s$*A?46sa;a&FvItA0Kv8jgC<=;PNt;kyfj>5c zAcvlM>@jcAQy-vxiM~Z1p+LV`lCmY#Hc(nL#o3u}=9}3W?fCrQ@mDRrPJaLUbN!|M z_XVD*ip9?>6_<&~JL5Z58DK~Cq}Z(QwfOoD3#l>@%gWcG4ur#c^XvB~<>OY1@8=I# z4xO&;PHe(8asnF4NTj(qJY+#vtv8umEDJh{j%g&LOyz1`K%T8t78X*a?MibjvX#tp z2uS9%6q%T9Xpx0!A!3u}nGmGr6fMJSAxtV1h3SUYBFkZ*W<@AdnJy@#2p+X-XctRB zvA^pu6EKJ=%ySjV5SSFJs9cG(&_U2#BH?sYECm^p+QK;2j$#oe8d0V|6x1x!wJesZ zEGQFsk;#b3m?YCEDPxYMSx)3i)?V0Lrz6*ZU{U5^!!etLs>?Y)g{HVJXNk<0CZRfj zpOpnPa~A6Sn#`x8GRj3#g$EP~4x0B(lvYa|I; zu|f*9=eHs%Si&skDoNBe(~MLaOXi-xswx>^Ih?60p?Ou+PgQ}ibqRD)bTC!5>!o}d zCJD_%oj~|Tx*^huYN&y2Im-)d3K=GZ9i;v4Q?7SZFtBOj^@9t`x5=5%*!NyLJ-bJS zHNm@K(uETYylFtt@GUpEB(G1Fdr9Yx+cU|2GxqJtggjrz;EcvY$A;W-yTfVEanI-! zwyuXQ?_lEtIPi#_)^Lsu+dhqKzdHcBb?OYA;L_A!eJ5}kyYKmA(b)0>r#l^5K8>gT z*h4c}ZV%9|tvR~tcCIf3YWOo|Rnu3YXu~OF?U;573AfSOa?AZ{W z+KA9P9om&U5bO>uXJk^(8d+x?rB5D^DxR!bMM@U~o5k$c!lxTJp39WFo*VdhHNn^q zw&oYk#5T$Doe3wW?|Y+)ETDLL{RtYMcz$p^Y#6&&Y8Uha`bGLLG zgF~K>H&g4yp9g1uU|RA0%>z@*x2@jDZm;5ihXg($%s0Df2IrQOCmi zFAObikYJOEh<_w_@qzu(rvFo7!qls3tjFQDvTft=!}$EsXFnd?eMCTo_4Uc($IdC> zKGO=YG5v1ew66Yr2z-QSu20ra_`2hKcmLqF`<-+H*?W3F('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], diff --git a/packages/server/src/config/database/redis/redis.config.ts b/packages/server/src/config/database/redis/redis.config.ts index a8a6f52d..bfc3386d 100644 --- a/packages/server/src/config/database/redis/redis.config.ts +++ b/packages/server/src/config/database/redis/redis.config.ts @@ -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, -}; \ No newline at end of file + password: process.env.REDIS_PASSWORD, +}; diff --git a/yarn.lock b/yarn.lock index 46e1e3bb..a5d79c3d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" @@ -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: @@ -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"