Last active
May 17, 2025 15:54
-
-
Save maxktz/7845a347f0c427c8c4337a83bc9eb305 to your computer and use it in GitHub Desktop.
Env `pnpm install dotenv zod`
This file contains hidden or 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/config"; | |
import { z } from "zod"; | |
const envSchema = z.object({ | |
RABBITMQ_URL: z.string().url(), | |
RABBITMQ_QUEUE: z.string().min(1), | |
}); | |
const parse = envSchema.safeParse(process.env); | |
if (!parse.success) { | |
console.error("❌ Invalid ENV variables:", parse.error.format()); | |
process.exit(1); | |
} | |
export const env = parse.data; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment