Created
January 29, 2022 09:02
-
-
Save cefn/d06cdc762d8433251499486190303245 to your computer and use it in GitHub Desktop.
Env Variable enforcement and typing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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