fix: hide dashboard + internal routes from swagger docs
This commit is contained in:
parent
fe7a0bf19b
commit
fd4af848bc
|
|
@ -13,7 +13,7 @@ await migrate();
|
|||
const app = new Elysia()
|
||||
.use(cors())
|
||||
.use(swagger({ path: "/docs", documentation: { info: { title: "PingQL API", version: "0.1.0" } } }))
|
||||
.get("/", () => ({ name: "PingQL", version: "0.1.0", docs: "/docs", dashboard: "/dashboard" }))
|
||||
.get("/", () => ({ name: "PingQL", version: "0.1.0", docs: "/docs", dashboard: "/dashboard" }), { detail: { hide: true } })
|
||||
.use(dashboard)
|
||||
.use(auth)
|
||||
.use(account)
|
||||
|
|
|
|||
|
|
@ -3,13 +3,12 @@ import { resolve } from "path";
|
|||
|
||||
const dir = resolve(import.meta.dir, "../dashboard");
|
||||
|
||||
export const dashboard = new Elysia()
|
||||
// Static assets
|
||||
.get("/dashboard/app.js", () => Bun.file(`${dir}/app.js`))
|
||||
.get("/dashboard/query-builder.js", () => Bun.file(`${dir}/query-builder.js`))
|
||||
const hide = { detail: { hide: true } };
|
||||
|
||||
// Pages
|
||||
.get("/dashboard", () => Bun.file(`${dir}/index.html`))
|
||||
.get("/dashboard/home", () => Bun.file(`${dir}/home.html`))
|
||||
.get("/dashboard/monitors/new", () => Bun.file(`${dir}/new.html`))
|
||||
.get("/dashboard/monitors/:id", () => Bun.file(`${dir}/detail.html`));
|
||||
export const dashboard = new Elysia()
|
||||
.get("/dashboard/app.js", () => Bun.file(`${dir}/app.js`), hide)
|
||||
.get("/dashboard/query-builder.js", () => Bun.file(`${dir}/query-builder.js`), hide)
|
||||
.get("/dashboard", () => Bun.file(`${dir}/index.html`), hide)
|
||||
.get("/dashboard/home", () => Bun.file(`${dir}/home.html`), hide)
|
||||
.get("/dashboard/monitors/new", () => Bun.file(`${dir}/new.html`), hide)
|
||||
.get("/dashboard/monitors/:id", () => Bun.file(`${dir}/detail.html`), hide);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
import { Elysia } from "elysia";
|
||||
import sql from "../db";
|
||||
|
||||
export const internal = new Elysia({ prefix: "/internal" })
|
||||
export const internal = new Elysia({ prefix: "/internal", detail: { hide: true } })
|
||||
.derive(({ headers, error }) => {
|
||||
if (headers["x-monitor-token"] !== process.env.MONITOR_TOKEN)
|
||||
return error(401, { error: "Unauthorized" });
|
||||
|
|
@ -13,6 +13,7 @@ export const internal = new Elysia({ prefix: "/internal" })
|
|||
|
||||
// Returns monitors that are due for a check
|
||||
.get("/due", async () => {
|
||||
|
||||
return sql`
|
||||
SELECT m.id, m.url, m.interval_s, m.query
|
||||
FROM monitors m
|
||||
|
|
|
|||
Loading…
Reference in New Issue