skunight/nestjs-redis

throw exceptions if redis not exists

Opened this issue · 1 comments

hello, first of all: nice module. Thank you for that.

To my problem:
I would use this redis connection not as requirement. That means: If no env variables for redis exists, the redis doesen´t connect to any host. But at the moment the module sad, that connection timeout for 127.0.0.1.

Is it possible to disable this warning?

My code:

import { Module } from '@nestjs/common';
import { RedisModule as NestJsRedisModule } from 'nestjs-redis';

@Module({
  imports: [
    NestJsRedisModule.forRootAsync({
      useFactory: () => {
        if (process.env.REDIS_HOST) {
          return {
            host: process.env.REDIS_HOST
          };
        }

        return {};
      },
    }),
  ],
})
export class RedisModule {}

Thank you very much.

Hi did you find a solution? I'm having the same problem, but in my case, the Redis could not exists. So I want to no throw an exception and make program to stop.