Skip to content

Commit 87adf04

Browse files
committed
Adoptation for v1.2.0, added option BULL_VERSION
1 parent d659e7f commit 87adf04

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:12-alpine
1+
FROM node:14.15-alpine
22

33
WORKDIR /usr/app
44

@@ -11,6 +11,7 @@ ENV REDIS_PORT 6379
1111
ENV REDIS_USE_TLS false
1212
ENV REDIS_PASSWORD ''
1313
ENV BULL_PREFIX bull
14+
ENV BULL_VERSION BULLMQ
1415

1516
RUN yarn install
1617

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ see "Example with docker-compose" section for example with env parameters
3333
* `REDIS_USE_TLS` - enable TLS true or false (false by default)
3434
* `REDIS_PASSWORD` - password to connect to redis (no password by default)
3535
* `BULL_PREFIX` - prefix to your bull queue name (bull by default)
36+
* `BULL_VERSION` - version of bull lib to use 'BULLMQ' or 'BULL' ('BULLMQ' by default)
3637
* `BASE_PATH` - basePath for bull board, e.g. '/bull-board' ('/' by default)
3738

3839
### Example with docker-compose

index.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
const {setQueues, router} = require('bull-board');
1+
const {router, setQueues, BullMQAdapter, BullAdapter} = require('bull-board')
22
const Queue = require('bull');
3+
const bullmq = require('bullmq');
34
const express = require('express');
45
const redis = require('redis');
56

@@ -9,6 +10,7 @@ const {
910
REDIS_PASSWORD,
1011
REDIS_USE_TLS,
1112
BULL_PREFIX = 'bull',
13+
BULL_VERSION = 'BULLMQ',
1214
PORT = 3000,
1315
BASE_PATH = '/'
1416
} = process.env;
@@ -29,7 +31,15 @@ const basePath = BASE_PATH;
2931

3032
client.KEYS(`${prefix}:*`, (err, keys) => {
3133
const uniqKeys = new Set(keys.map(key => key.replace(/^.+?:(.+?):.+?$/, '$1')));
32-
const queueList = Array.from(uniqKeys).map((item) => new Queue(item, redisConfig));
34+
const queueList = Array.from(uniqKeys).sort().map(
35+
(item) => {
36+
if (BULL_VERSION === 'BULLMQ') {
37+
return new BullMQAdapter(new bullmq.Queue(item, {connection: redisConfig.redis}));
38+
}
39+
40+
return new BullAdapter(new Queue(item, redisConfig));
41+
}
42+
);
3343

3444
setQueues(queueList);
3545
});

0 commit comments

Comments
 (0)