From b72c82d262d39596091d8d1d955cefe5f8861f83 Mon Sep 17 00:00:00 2001 From: RinYato Date: Fri, 11 Oct 2024 17:22:13 +0700 Subject: [PATCH] chore: remove basic auth from docs --- apps/api/src/lib/tasker.ts | 16 +++++++++------- apps/api/src/setup/openapi.ts | 5 ----- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/apps/api/src/lib/tasker.ts b/apps/api/src/lib/tasker.ts index fc7e0e9..b788c61 100644 --- a/apps/api/src/lib/tasker.ts +++ b/apps/api/src/lib/tasker.ts @@ -12,16 +12,18 @@ export function registerTasker(app: App, taskers: Tasker[]) { // start all taskers taskers.forEach((tasker) => tasker.start()); - const serverAdapter = new HonoAdapter(serveStatic); + if (env.NODE_ENV !== "production") { + const serverAdapter = new HonoAdapter(serveStatic); - createBullBoard({ - queues: taskers.map(createBullAdapter), - serverAdapter, - }); + createBullBoard({ + queues: taskers.map(createBullAdapter), + serverAdapter, + }); - serverAdapter.setBasePath("/queue"); + serverAdapter.setBasePath("/queue"); - app.use("/queue", basicAuth(BASIC_AUTH)).route("/queue", serverAdapter.registerPlugin()); + app.use("/queue", basicAuth(BASIC_AUTH)).route("/queue", serverAdapter.registerPlugin()); + } } function createBullAdapter(tasker: Tasker) { diff --git a/apps/api/src/setup/openapi.ts b/apps/api/src/setup/openapi.ts index c6bf363..90fc187 100644 --- a/apps/api/src/setup/openapi.ts +++ b/apps/api/src/setup/openapi.ts @@ -1,13 +1,8 @@ import { apiReference } from "@scalar/hono-api-reference"; import type { App } from "./context"; import { env } from "@/lib/env"; -import { basicAuth } from "hono/basic-auth"; -import { BASIC_AUTH } from "@/constant/basic-auth"; export function registerOpenAPI(app: App) { - app.use("/docs/*", basicAuth(BASIC_AUTH)); - app.use("/openapi", basicAuth(BASIC_AUTH)); - app.doc31("/openapi", { openapi: "3.1.0", info: {