Skip to content

Commit

Permalink
feat: allow to pass a string url to redis
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoomen committed Mar 8, 2021
1 parent 97e939f commit 39cd987
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/throttler-storage-redis.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ export class ThrottlerStorageRedisService implements ThrottlerStorageRedis {

constructor(redis?: Redis.Redis);
constructor(options?: Redis.RedisOptions);
constructor(redisOrOptions?: Redis.Redis | Redis.RedisOptions) {
constructor(url?: string);
constructor(redisOrOptions?: Redis.Redis | Redis.RedisOptions | string) {
if (redisOrOptions instanceof Redis) {
this.redis = redisOrOptions;
} else if (typeof redisOrOptions === 'string') {
this.redis = new Redis(redisOrOptions as string);
} else {
this.redis = new Redis(redisOrOptions);
}
Expand Down

0 comments on commit 39cd987

Please sign in to comment.