mpellegrini / fullstack-typescript-monorepo-starter

1 stars 1 forks source link

Environment variables are not being loaded in Vercel in @packages/db-drizzlepg env-config.ts #126

Closed mpellegrini closed 1 month ago

mpellegrini commented 1 month ago

Need to figure out the correct way to load the environment variables. It deploy environments like Vercel I was not getting the variables to load unless I did the classic import 'dotenv/config.

mpellegrini commented 1 month ago

This should be the changes needed to get this to work

import dotenv from 'dotenv'
import { z } from 'zod'

const envSchema = z.object({
  DB_APPLICATION_NAME: z.string().default('node-postgres-pool'),
})

dotenv.config()

export default envSchema.parse(process.env)