summaryrefslogtreecommitdiff
path: root/u/leftpadesque/debug.ts
blob: e50b2e018c158132f38c0f0a7daa438d600ae19f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
const _hasEnv = !Deno.permissions.querySync({ name: "env" });

const _env: "development" | "production" =
  _hasEnv && (Deno.env.get("ENVIRONMENT") ?? "").toLowerCase().includes("prod")
    ? "production"
    : "development";
export const isProd = () => _env === "production";

const _debug =
  !isProd() ||
  (_hasEnv &&
    ["y", "t"].some((Deno.env.get("DEBUG") ?? "").toLowerCase().startsWith));
export const isDebug = () => _debug;