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) <noreply@anthropic.com>
This commit is contained in:
Lum1104
2026-05-11 22:02:58 +08:00
Unverified
parent 788aa90802
commit 1779cbd9a7
@@ -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[] {