diff --git a/src/lib/document-stores/redis.ts b/src/lib/document-stores/redis.ts index c2e3101..0e046e0 100644 --- a/src/lib/document-stores/redis.ts +++ b/src/lib/document-stores/redis.ts @@ -30,10 +30,20 @@ class RedisDocumentStore implements Store { connect = (options: RedisStoreConfig) => { winston.info('configuring redis') - const url = process.env.REDISTOGO_URL || options.url || 'redis://redis:6379' + const url = process.env.REDISTOGO_URL || options.url + const host = options.host || '127.0.0.1' + const port = options.port || 6379 const index = options.db || 0 + + const connectionParameters = url ? { + url + }: { + host, + port + } + const config = { - url, + ...connectionParameters, database: index as number, ...(options.username ? { username: options.username } : {}), ...(options.password ? { username: options.username } : {}), diff --git a/src/types/config.ts b/src/types/config.ts index 37fee16..7544f29 100644 --- a/src/types/config.ts +++ b/src/types/config.ts @@ -56,6 +56,8 @@ export interface RedisStoreConfig extends BaseStoreConfig { user?: string username?: string | undefined password?: string + host?: string + port?: string } export type GoogleStoreConfig = BaseStoreConfig