Skip to content

Commit

Permalink
Add doc for all available options
Browse files Browse the repository at this point in the history
  • Loading branch information
felixmosh committed Jan 3, 2023
1 parent c96658f commit e88c6fa
Showing 1 changed file with 60 additions and 7 deletions.
67 changes: 60 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,34 @@ For more advanced usages check the `examples` folder, currently it contains:
2. [With Fastify server](https://github.com/felixmosh/bull-board/tree/master/examples/with-fastify)
2. [With Hapi.js server](https://github.com/felixmosh/bull-board/tree/master/examples/with-hapi)
2. [With Koa.js server](https://github.com/felixmosh/bull-board/tree/master/examples/with-koa)

### Board options
1. `uiConfig.boardTitle` (default: `empty`)
The Board title
2. `uiConfig.boardLogo` (default: `empty`) `{ path: string; width?: number | string; height?: number | string }`
An object that allows you to specify a different logo

```js
const QueueMQ = require('bullmq');
const {createBullBoard} = require('@bull-board/api');
const {BullMQAdapter} = require('@bull-board/api/bullMQAdapter');

const queueMQ = new QueueMQ();

createBullBoard(
{
queues: [new BullMQAdapter(queueMQ)],
},
serverAdapter,
{
uiConfig: {
boardTitle: 'My BOARD',
boardLogo: {path: 'https://cdn.my-domain.com/logo.png', width: '100px', height: 200},
},
}
);
```

### Queue options
1. `readOnlyMode` (default: `false`)
Makes the UI as read only, hides all queue & job related actions
Expand All @@ -117,13 +145,11 @@ const { BullMQAdapter } = require('@bull-board/api/bullMQAdapter')
const { BullAdapter } = require('@bull-board/api/bullAdapter')

const someQueue = new Queue()
const someOtherQueue = new Queue()
const queueMQ = new QueueMQ()

const { setQueues, replaceQueues } = createBullBoard({
createBullBoard({
queues: [
new BullAdapter(someQueue, { readOnlyMode: true }), // only this queue will be in read only mode
new BullAdapter(someOtherQueue),
new BullMQAdapter(queueMQ, { readOnlyMode: true }),
]
})
Expand All @@ -139,18 +165,45 @@ const { BullMQAdapter } = require('@bull-board/api/bullMQAdapter')
const { BullAdapter } = require('@bull-board/api/bullAdapter')

const someQueue = new Queue()
const someOtherQueue = new Queue()
const queueMQ = new QueueMQ()

const { setQueues, replaceQueues } = createBullBoard({
createBullBoard({
queues: [
new BullAdapter(someQueue),
new BullAdapter(someOtherQueue, , { allowRetries: false }), // No retry buttons
new BullAdapter(someQueue, { allowRetries: false }), // No retry buttons
new BullMQAdapter(queueMQ, { allowRetries: true, readOnlyMode: true }), // allowRetries will be ignored in this case in lieu of readOnlyMode
]
})
```

3. `description` (default: `empty`)
Queue description text.

4. `prefix` (default: `empty`)
Job name prefix.
5. `queueAdapter.setFormatter(field: 'data' | 'returnValue' | 'name', formatter: (fieldData) => any)`
You can specify a formatter for `'data' | 'returnValue' | 'name'` job's fields.

```js
const QueueMQ = require('bullmq');
const fastRedact = require('fast-redact');
const { createBullBoard } = require('@bull-board/api');
const { BullMQAdapter } = require('@bull-board/api/bullMQAdapter');

const redact = fastRedact({
paths: ['headers.cookie', 'password', 'access_token']
})

const queueMQ = new QueueMQ()
const queueAdapter = new BullMQAdapter(queueMQ);
queueAdapter.setFormatter('name', (name) => `#Queue1 - ${name}`);
queueAdapter.setFormatter('data', (data) => redact(data));
queueAdapter.setFormatter('returnValue', (returnValue) => redact(returnValue));

createBullBoard({
queues: [queueAdapter]
})
```

### Hosting router on a sub path

If you host your express service on a different path than root (/) ie. https://<server_name>/<sub_path>/, then you can add the following code to provide the configuration to the bull-board router. In this example the sub path will be `my-base-path`.
Expand Down

0 comments on commit e88c6fa

Please sign in to comment.