Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

throw exceptions if redis not exists #35

Open
volbrene opened this issue Feb 11, 2020 · 1 comment
Open

throw exceptions if redis not exists #35

volbrene opened this issue Feb 11, 2020 · 1 comment

Comments

@volbrene
Copy link

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.

@rodrigocnascimento
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants