docker run --rm -p 3000:3000 ghcr.io/sgasser/pasteguard:latest
```
+Open [localhost:3000](http://localhost:3000) for the dashboard.
+
Point your tools or app to PasteGuard instead of the provider:
| Target | PasteGuard URL | Original URL |
<img src="assets/dashboard.png" width="100%" alt="PasteGuard Dashboard">
-[localhost:3000/dashboard](http://localhost:3000/dashboard)
+[localhost:3000](http://localhost:3000)
## What it catches
```
PasteGuard runs on `http://localhost:3000`. Open
-[http://localhost:3000/dashboard](http://localhost:3000/dashboard) for the dashboard.
+[http://localhost:3000](http://localhost:3000) for the dashboard.
<Note>
The first start loads the detection model and can take a little longer; the
docker run --rm -p 3000:3000 ghcr.io/sgasser/pasteguard:latest
```
-PasteGuard runs on `http://localhost:3000`. Open `http://localhost:3000/dashboard` to see the dashboard.
+PasteGuard runs on `http://localhost:3000`. Open `http://localhost:3000` to see the dashboard.
<Note>
For custom configuration or persistent logs, see [Installation](/installation).
## 4. View Dashboard
-Open `http://localhost:3000/dashboard` in your browser to see:
+Open `http://localhost:3000` in your browser to see:
- Request history
- Detected PII entities
-import { describe, expect, test } from "bun:test";
+import { afterEach, describe, expect, test } from "bun:test";
import { Hono } from "hono";
+import { getConfig } from "../config";
import { healthRoutes } from "./health";
const app = new Hono();
app.route("/", healthRoutes);
+const config = getConfig();
+const originalDashboardEnabled = config.dashboard.enabled;
+
+afterEach(() => {
+ config.dashboard.enabled = originalDashboardEnabled;
+});
+
+describe("GET /", () => {
+ test("redirects to dashboard when dashboard is enabled", async () => {
+ config.dashboard.enabled = true;
+
+ const res = await app.request("/");
+
+ expect(res.status).toBe(302);
+ expect(res.headers.get("Location")).toBe("/dashboard");
+ });
+
+ test("redirects to health when dashboard is disabled", async () => {
+ config.dashboard.enabled = false;
+
+ const res = await app.request("/");
+
+ expect(res.status).toBe(302);
+ expect(res.headers.get("Location")).toBe("/health");
+ });
+});
+
describe("GET /health", () => {
test("returns health status", async () => {
const res = await app.request("/health");
export const healthRoutes = new Hono();
+healthRoutes.get("/", (c) => {
+ const config = getConfig();
+ return c.redirect(config.dashboard.enabled ? "/dashboard" : "/health");
+});
+
healthRoutes.get("/health", async (c) => {
const config = getConfig();
const piiEnabled = config.pii_detection.enabled;