import Redis from 'ioredis';
import { getWorkerConfig } from '@wcag-ada/config';

const workerConfig = getWorkerConfig();

export function createRedisConnection(): Redis {
  return new Redis({
    host: workerConfig.redis.host,
    port: workerConfig.redis.port,
    password: workerConfig.redis.password,
    db: workerConfig.redis.db,
    maxRetriesPerRequest: workerConfig.redis.maxRetriesPerRequest,
  });
}