diff options
author | Elizabeth Hunt <lizhunt@amazon.com> | 2025-05-13 18:58:45 -0700 |
---|---|---|
committer | Elizabeth Hunt <lizhunt@amazon.com> | 2025-05-13 18:58:54 -0700 |
commit | 1d66a0f58e4ebcdf4f42c9d78f82a1ab49a2cf11 (patch) | |
tree | 07073c060b61688e4635fd4658315cc683589d3d /u/leftpadesque/debug.ts | |
parent | 2543ac8b11af11f034836591046cdb52911f9403 (diff) | |
download | ci-1d66a0f58e4ebcdf4f42c9d78f82a1ab49a2cf11.tar.gz ci-1d66a0f58e4ebcdf4f42c9d78f82a1ab49a2cf11.zip |
snapshot!
Diffstat (limited to 'u/leftpadesque/debug.ts')
-rw-r--r-- | u/leftpadesque/debug.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/u/leftpadesque/debug.ts b/u/leftpadesque/debug.ts new file mode 100644 index 0000000..a9da1f3 --- /dev/null +++ b/u/leftpadesque/debug.ts @@ -0,0 +1,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; |