summaryrefslogtreecommitdiff
path: root/u/leftpadesque/debug.ts
blob: a9da1f35a6f5a15638e9564fae2e8982a6445054 (plain)
1
2
3
4
5
6
7
8
9
10
11
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;