@bullstudio/ fastify (英语)
将Bulstudio嵌入式模式的框架适配器快速化.
使用此软件包在 Fastify 应用程序内挂载一个仪表板实例 。 这个 适配器在一个下为仪表板资产和私人仪表板API服务 注册前缀.
安装
pnpm add @bullstudio/fastify
也安装一个队列适配软件包, 例如
@bullstudio/bullmq-adapter 或者说 @bullstudio/bull-adapter。 。 。 .
使用量
import { createBullMqQueueAdapter } from "@bullstudio/bullmq-adapter";
import { bullstudio } from "@bullstudio/fastify";
import { Queue } from "bullmq";
import Fastify from "fastify";
const emailQueue = new Queue("email", { connection });
const app = Fastify();
await app.register(
bullstudio({
queues: [
createBullMqQueueAdapter(emailQueue, {
key: "email",
label: "Email",
}),
],
protection: {
type: "basic",
username: process.env.BULLSTUDIO_USERNAME ?? "operator",
password: process.env.BULLSTUDIO_PASSWORD ?? "change-me",
},
}),
{
prefix: "/ops/bullstudio",
},
);
await app.listen({ port: 3000 });
打开 /ops/bullstudio 查看仪表板.
配置
bullstudio(config) 接受共享嵌入式仪表板配置 :
| 选项 | 说明 |
|---|---|
queues | 排队适配器在仪表板上曝光. |
readOnly | 阻断队列和工作操作 true。 。 。 . |
protection | 保护板 基本Auth是通常的生产选择. |
dashboardIdentity | 可见仪表盘标题和可选标志. |
documentIdentity | 浏览器文档标题和可选的favicon. |
嵌入模式只显示已提供的队列 。 公牛队没有发现所有雷迪斯 队列,而不拥有传递给它的队列的生命周期.