From 7ea3f39b0b39db8c306f50411aac6be66235e3f3 Mon Sep 17 00:00:00 2001 From: Paulo Margarido <64600052+paulomarg@users.noreply.github.com> Date: Fri, 22 Jul 2022 09:38:31 -0400 Subject: [PATCH] Allow redis options in session storage --- CHANGELOG.md | 2 ++ src/auth/session/storage/redis.ts | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8f9b0b4d..382d544ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## Unreleased +- Allow passing in options for the Redis client used by the session storage strategy [#430](https://github.com/Shopify/shopify-api-node/pull/430) + ## [4.2.0] - 2022-07-20 - Return a 401 instead of 403 when webhooks fail validation [#425](https://github.com/Shopify/shopify-api-node/pull/425) diff --git a/src/auth/session/storage/redis.ts b/src/auth/session/storage/redis.ts index e74263e5f..aecdee526 100644 --- a/src/auth/session/storage/redis.ts +++ b/src/auth/session/storage/redis.ts @@ -1,10 +1,10 @@ -import {createClient, RedisClientType} from 'redis'; +import {createClient, RedisClientType, RedisClientOptions} from 'redis'; import {SessionInterface} from '../types'; import {SessionStorage} from '../session_storage'; import {sessionFromEntries, sessionEntries} from '../session-utils'; -export interface RedisSessionStorageOptions { +export interface RedisSessionStorageOptions extends RedisClientOptions { sessionKeyPrefix: string; } const defaultRedisSessionStorageOptions: RedisSessionStorageOptions = { @@ -103,6 +103,7 @@ export class RedisSessionStorage implements SessionStorage { private async init() { this.client = createClient({ + ...this.options, url: this.dbUrl.toString(), }); await this.client.connect();