blob: 65a1e2a821f7a87bf186edfb995c983675aa3a80 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import type { DispatchConfig } from "@dispatch/core";
import { Hono } from "hono";
let getConfig: () => DispatchConfig = () => ({ permissions: {} });
export function setConfigGetter(getter: () => DispatchConfig): void {
getConfig = getter;
}
const configRoutes = new Hono();
configRoutes.get("/", (c) => {
const config = getConfig();
// Strip env field values from keys for security
const safeConfig: DispatchConfig = {
...config,
keys: config.keys?.map((key) => ({
...key,
env: "***",
})),
};
return c.json({ config: safeConfig });
});
export { configRoutes };
|