mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 18:52:06 +00:00
Add environment variable validation and parsing
Adds a validation schema for the application's environment variables using the Zod library. The parsed environment variables are then exported as constants that can be imported throughout the application, replacing the direct use of process.env.
This commit is contained in:
@@ -1,12 +1,7 @@
|
||||
import { BasicUserInfoSchema } from '@/config/auth/types';
|
||||
import jwt from 'jsonwebtoken';
|
||||
import { z } from 'zod';
|
||||
|
||||
const { CONFIRMATION_TOKEN_SECRET } = process.env;
|
||||
|
||||
if (!CONFIRMATION_TOKEN_SECRET) {
|
||||
throw new Error('CONFIRMATION_TOKEN_SECRET is not defined');
|
||||
}
|
||||
import { CONFIRMATION_TOKEN_SECRET } from '../env';
|
||||
|
||||
type User = z.infer<typeof BasicUserInfoSchema>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user