fix env vars for vite

This commit is contained in:
Brian Beck 2026-03-13 23:59:01 -07:00
parent 842ddb7df7
commit 8542e07259
24 changed files with 35 additions and 32 deletions

View file

@ -3,7 +3,7 @@ import pino from "pino";
/**
* Module-scoped browser logging via pino.
*
* Control via NEXT_PUBLIC_LOG (comma-separated):
* Control via VITE_LOG (comma-separated):
* "debug" all modules at debug
* "liveStreaming:debug,DebugSuspense:trace" those modules only, rest silent
* "debug,liveStreaming:trace" all at debug, liveStreaming at trace
@ -27,12 +27,12 @@ const PINO_LEVELS = new Set([
"silent",
]);
/** Parse NEXT_PUBLIC_LOG into a global default and per-module overrides. */
/** Parse VITE_PUBLIC_LOG into a global default and per-module overrides. */
function parseLogConfig(): {
globalLevel: string;
modules: Map<string, string>;
} {
const raw = import.meta.env.NEXT_PUBLIC_LOG?.trim();
const raw = import.meta.env.VITE_PUBLIC_LOG?.trim();
if (!raw) return { globalLevel: "info", modules: new Map() };
let globalLevel: string | null = null;

View file

@ -50,7 +50,7 @@ export interface LiveConnectionStore extends LiveConnectionState {
}
const DEFAULT_RELAY_URL =
import.meta.env.NEXT_PUBLIC_RELAY_URL || "ws://localhost:8765";
import.meta.env.VITE_RELAY_URL || "ws://localhost:8765";
export const liveConnectionStore = createStore<LiveConnectionStore>(
(set, get) => ({

View file

@ -1670,6 +1670,7 @@ describe("TorqueScript Runtime", () => {
const warnSpy2 = vi.spyOn(console, "warn").mockImplementation(() => {});
script.execute();
expect(warnSpy2).toHaveBeenCalledWith(
"[runtime]",
'exec("scripts/test.cs"): script not found',
);
warnSpy2.mockRestore();
@ -1767,6 +1768,7 @@ describe("TorqueScript Runtime", () => {
await runtime.loadFromSource('exec("scripts/missing.cs");');
expect(warnSpy).toHaveBeenCalledWith(
"[runtime]",
"Script not found: scripts/missing.cs",
);
warnSpy.mockRestore();
@ -2939,6 +2941,7 @@ describe("TorqueScript Runtime", () => {
expect(runtime.$g.get("Main")).toBe(1);
expect(runtime.$g.get("AI")).toBe(""); // Not loaded
expect(warnSpy).toHaveBeenCalledWith(
"[runtime]",
"Ignoring script: scripts/ai/brain.cs",
);
warnSpy.mockRestore();
@ -3009,7 +3012,7 @@ describe("TorqueScript Runtime", () => {
// Should only warn once (second exec sees it's already in failedScripts)
expect(
warnSpy.mock.calls.filter(
(c) => c[0] === "Ignoring script: scripts/ignored.cs",
(c) => c[1] === "Ignoring script: scripts/ignored.cs",
).length,
).toBe(1);
// Loader should only be called for main.cs, not for ignored.cs