validate env with a script
This commit is contained in:
parent
b62bc0ca46
commit
dd8457e06c
2 changed files with 22 additions and 2 deletions
19
scripts/validate-env.ts
Normal file
19
scripts/validate-env.ts
Normal 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();
|
||||
Loading…
Add table
Add a link
Reference in a new issue