diff --git a/src/redis_manager.ts b/src/redis_manager.ts index 003159d..ab05f40 100644 --- a/src/redis_manager.ts +++ b/src/redis_manager.ts @@ -62,14 +62,6 @@ class RedisManager extends Emitter this.#logger.fatal({ err: data.error }, 'Redis connection failure') }.bind(this) - /** - * User provided config - */ - #config: { - connection: keyof ConnectionsList - connections: ConnectionsList - } - /** * Reference to "import('ioredis').Redis.Command" */ @@ -91,11 +83,10 @@ class RedisManager extends Emitter } constructor( - config: { connection: keyof ConnectionsList; connections: ConnectionsList }, + public managerConfig: { connection: keyof ConnectionsList; connections: ConnectionsList }, logger: Logger ) { super() - this.#config = config this.#logger = logger } @@ -126,7 +117,7 @@ class RedisManager extends Emitter connection( connectionName?: ConnectionName ): GetConnectionType { - const name = connectionName || this.#config.connection + const name = connectionName || this.managerConfig.connection debug('resolving connection %s', name) /** @@ -140,7 +131,7 @@ class RedisManager extends Emitter /** * Get config for the named connection */ - const config = this.#config.connections[name] + const config = this.managerConfig.connections[name] if (!config) { throw new RuntimeException(`Redis connection "${name.toString()}" is not defined`) } @@ -273,7 +264,7 @@ class RedisManager extends Emitter * name is defined. */ async quit(name?: ConnectionName) { - const connection = this.activeConnections[name || this.#config.connection] + const connection = this.activeConnections[name || this.managerConfig.connection] if (!connection) { return } @@ -286,7 +277,7 @@ class RedisManager extends Emitter * name is defined. */ async disconnect(name?: ConnectionName) { - const connection = this.activeConnections[name || this.#config.connection] + const connection = this.activeConnections[name || this.managerConfig.connection] if (!connection) { return }