File size: 667 Bytes
3206347
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import basicAuth from 'express-basic-auth';
import appConfig from '../config/app.js';

const injectBullBoardHandler = async (app, serverAdapter) => {
  if (
    !appConfig.enableBullMQDashboard ||
    !appConfig.bullMQDashboardUsername ||
    !appConfig.bullMQDashboardPassword
  )
    return;

  const queueDashboardBasePath = '/admin/queues';
  serverAdapter.setBasePath(queueDashboardBasePath);

  app.use(
    queueDashboardBasePath,
    basicAuth({
      users: {
        [appConfig.bullMQDashboardUsername]: appConfig.bullMQDashboardPassword,
      },
      challenge: true,
    }),
    serverAdapter.getRouter()
  );
};

export default injectBullBoardHandler;