Skip to content

Instantly share code, notes, and snippets.

@cefn
Created January 29, 2022 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cefn/d06cdc762d8433251499486190303245 to your computer and use it in GitHub Desktop.
Save cefn/d06cdc762d8433251499486190303245 to your computer and use it in GitHub Desktop.
Env Variable enforcement and typing
import dotenv from "dotenv";
import { z } from "zod";
dotenv.config();
const envSchema = z.object({
COUCHDB_USER: z.string().min(1),
COUCHDB_PASSWORD: z.string().min(1),
});
export const env = envSchema.parse(process.env);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment