znv
znv copied to clipboard
Type-safe environment parsing and validation for Node.js with Zod schemas
Hello there, The following code: ```ts import { parseEnv } from 'znv'; import { z } from 'zod'; export const { DEFAULT_ADMIN_EMAILS, } = parseEnv(process.env, { DEFAULT_ADMIN_EMAILS: z .string() .optional()...
Znv causes an error if it's run "on the edge" (for example on [Vecel's Edge Runtime](https://vercel.com/docs/concepts/functions/edge-functions)). ``` error - Error: The edge runtime does not support Node.js 'tty' module. Learn...
Resolves #2, supersedes #9 and #11. This PR adds support for non-Node runtimes via a new entrypoint, `znv/compat`. To accomplish this, I've added the ability to pass a custom reporter...
This is just a rough draft. I think a better approach would be to use the export map to import different implementation. e.g. ``` import { parseEnv } from "znv/node";...
This PR adds an optional `valueStringifier` property in the `DetailedSpec` that allows the user to customize the way the received value is displayed in the errors report. This allows secrets...
I'm going to be using this for the web and many bundlers/frameworks enforce a prefix for web available environmental variables. This is something like `NEXT_PUBLIC_API_URL` or `VITE_API_URL`. I would love...
This should fix #12
Hey, thanks for the great library. I've set this up in my `./config.ts` file as so: ```ts import { parseEnv, z } from "znv"; import type { Environment } from...