validate env with a script

This commit is contained in:
Benjamin Palko 2025-01-02 10:12:21 -05:00
parent b62bc0ca46
commit dd8457e06c
2 changed files with 22 additions and 2 deletions

19
scripts/validate-env.ts Normal file
View file

@ -0,0 +1,19 @@
import { PhoneRegex } from '../src/lib/regex/phone';
import { z } from 'zod';
const ValidateEnvironment = () => {
const { success, error } = z
.object({
TWILIO_ACCOUNT_SID: z.string().min(1),
TWILIO_AUTH_TOKEN: z.string().min(1),
TWILIO_PHONE_NUMBER: z.string().regex(PhoneRegex),
})
.safeParse(process.env);
if (!success) {
console.error(error.message);
process.exit(1);
}
};
ValidateEnvironment();