From 1779cbd9a78c4147806e8bb7ede00870277a4e80 Mon Sep 17 00:00:00 2001 From: Lum1104 Date: Mon, 11 May 2026 22:02:58 +0800 Subject: [PATCH] feat(dashboard): allow ACCESS_TOKEN override via env var Honor UNDERSTAND_ACCESS_TOKEN if set, falling back to the random 16-byte hex token. Lets the dev token survive across server restarts so shared dashboard URLs don't rot, and makes the auth path easier to script in tests. Co-Authored-By: Claude Opus 4.7 (1M context) --- understand-anything-plugin/packages/dashboard/vite.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/understand-anything-plugin/packages/dashboard/vite.config.ts b/understand-anything-plugin/packages/dashboard/vite.config.ts index c28056b..46b8668 100644 --- a/understand-anything-plugin/packages/dashboard/vite.config.ts +++ b/understand-anything-plugin/packages/dashboard/vite.config.ts @@ -9,7 +9,7 @@ import crypto from "crypto"; // Generate a one-time token when the server process starts. // This token is printed to the terminal and must be in the URL // to fetch knowledge-graph.json or diff-overlay.json. -const ACCESS_TOKEN = crypto.randomBytes(16).toString("hex"); +const ACCESS_TOKEN = process.env.UNDERSTAND_ACCESS_TOKEN || crypto.randomBytes(16).toString("hex"); const MAX_SOURCE_FILE_BYTES = 1024 * 1024; function graphFileCandidates(fileName: string): string[] {