Skip to content

Commit

Permalink
fix: make redis option optional
Browse files Browse the repository at this point in the history
  • Loading branch information
bassochette committed Mar 6, 2022
1 parent aef14e8 commit e5d52ac
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/redis/redis.provider.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Inject, Injectable, Logger } from "@nestjs/common";
import { Inject, Injectable, Logger, Optional } from "@nestjs/common";
import { REDIS_OPTIONS, RedisConnectionOptions } from "./redis.config";
import { createClient } from "redis";
import { REDIS_CLIENT, RedisClient } from "./redis.client";
Expand All @@ -8,7 +8,9 @@ export class RedisProvider {
client: RedisClient;

constructor(
@Inject(REDIS_OPTIONS) private readonly options: RedisConnectionOptions
@Optional()
@Inject(REDIS_OPTIONS)
private readonly options: RedisConnectionOptions
) {}

async getClient(): Promise<RedisClient> {
Expand Down

0 comments on commit e5d52ac

Please sign in to comment.