-
nestjs에서 registerAsync 사용시 isGlobal 설정NodeJS 2024. 6. 12. 16:12728x90
nestjs에서 registerAsync 사용시 isGlobal 설정
useFactory에 isGlobal을 설정 했지만, 동작 하지 않아서 테스트 해보다 보니 위치가 아래와 같습니다.
@Module({ imports: [ ConfigModule.forRoot({ envFilePath: ['.env.local', '.env'], isGlobal: true, load: [database, logging, redis, cache, throttler], }), CacheModule.registerAsync({ isGlobal: true, // 여기에 들어가야 한다. imports: [ConfigModule], inject: [ConfigService], useFactory: (configService: ConfigService) => configService.get('cacheConfig'), // 여기에 넣었다가 실패.. }), ], controllers: [AppController], providers: [ ], }) export class AppModule implements NestModule { }
728x90'NodeJS' 카테고리의 다른 글
[Nestjs TIP] whitelist 사용시 주의점! (0) 2024.06.18 [Nestjs TIP] Request Header에 validate 처리 (0) 2024.06.17 nestjs에서 swagger사용시, generic 타입에 대한 response schema 처리 (0) 2023.06.05 정규식을 이용해서 package-lock.json의 주소를 변경 처리 (0) 2023.06.02 VSCode에서 Jest Debug 설정 (0) 2023.05.31