2021-05-07 13:24:51 +02:00
|
|
|
const { createBullBoard } = require("bull-board")
|
|
|
|
const { BullAdapter } = require("bull-board/bullAdapter")
|
|
|
|
const { getQueues } = require("./triggers")
|
|
|
|
const express = require("express")
|
|
|
|
|
|
|
|
exports.pathPrefix = "/bulladmin"
|
|
|
|
|
|
|
|
exports.init = () => {
|
|
|
|
const expressApp = express()
|
|
|
|
// Set up queues for bull board admin
|
|
|
|
const queues = getQueues()
|
|
|
|
const adapters = []
|
|
|
|
for (let queue of queues) {
|
|
|
|
adapters.push(new BullAdapter(queue))
|
|
|
|
}
|
|
|
|
const { router } = createBullBoard(adapters)
|
|
|
|
|
|
|
|
expressApp.use(exports.pathPrefix, router)
|
|
|
|
return expressApp
|
2021-05-07 14:55:57 +02:00
|
|
|
}
|