make redis host and port optional

This commit is contained in:
HorizonCode 2025-01-10 01:19:06 +01:00
parent bd5987fb46
commit f65ab42231
2 changed files with 4 additions and 4 deletions

View File

@ -19,7 +19,7 @@ export class MutexLock {
static async create(options: MutexOptions) {
const redisClient = await redis
.createClient({
url: `redis://${options.redis.host}:${options.redis.port}`,
url: `redis://${options.redis?.host ?? "127.0.0.1"}:${options.redis?.port ?? 6379}`,
})
.connect();

View File

@ -1,7 +1,7 @@
export type MutexOptions = {
redis: {
host: string;
port: number;
redis?: {
host?: string;
port?: number;
};
mutex?: {
checkInterval?: number;