make redis host and port optional
This commit is contained in:
parent
bd5987fb46
commit
f65ab42231
@ -19,7 +19,7 @@ export class MutexLock {
|
|||||||
static async create(options: MutexOptions) {
|
static async create(options: MutexOptions) {
|
||||||
const redisClient = await redis
|
const redisClient = await redis
|
||||||
.createClient({
|
.createClient({
|
||||||
url: `redis://${options.redis.host}:${options.redis.port}`,
|
url: `redis://${options.redis?.host ?? "127.0.0.1"}:${options.redis?.port ?? 6379}`,
|
||||||
})
|
})
|
||||||
.connect();
|
.connect();
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
export type MutexOptions = {
|
export type MutexOptions = {
|
||||||
redis: {
|
redis?: {
|
||||||
host: string;
|
host?: string;
|
||||||
port: number;
|
port?: number;
|
||||||
};
|
};
|
||||||
mutex?: {
|
mutex?: {
|
||||||
checkInterval?: number;
|
checkInterval?: number;
|
||||||
|
Loading…
Reference in New Issue
Block a user