feat: Convert helpers to use JS files
This commit is contained in:
27
packages/backend/src/helpers/inject-bull-board-handler.js
Normal file
27
packages/backend/src/helpers/inject-bull-board-handler.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import basicAuth from 'express-basic-auth';
|
||||
import appConfig from '../config/app';
|
||||
|
||||
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;
|
Reference in New Issue
Block a user