From a0c3931bf8d9a0bf23bd710851c5f76a502e799d Mon Sep 17 00:00:00 2001 From: Simon Lecoq <22963968+lowlighter@users.noreply.github.com> Date: Wed, 30 Oct 2024 02:25:53 -0400 Subject: [PATCH] fix: do not die on DEBUG variable env permissions not granted (#103) --- src/debug.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/debug.ts b/src/debug.ts index 56af80b..e86ffe4 100644 --- a/src/debug.ts +++ b/src/debug.ts @@ -1,5 +1,7 @@ /** Whether to enable debug logging. */ -export const DEBUG = !!Deno.env.get("DEBUG"); +export const DEBUG = + (Deno.permissions.querySync({ name: "env", variable: "DEBUG" }).state === + "granted") && (!!Deno.env.get("DEBUG")); /** Attach a websocket to the console for debugging. */ export function attachWs(ws: WebSocket) {