mirror of
https://github.com/penxio/penx.git
synced 2026-01-12 23:18:09 -05:00
23 lines
599 B
JavaScript
23 lines
599 B
JavaScript
// @ts-check
|
|
/**
|
|
* This file is included in `/next.config.js` which ensures the app isn't built with invalid env vars.
|
|
* It has to be a `.js`-file to be imported there.
|
|
*/
|
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
const { z } = require('zod')
|
|
|
|
/*eslint sort-keys: "error"*/
|
|
const envSchema = z.object({
|
|
NODE_ENV: z.enum(['development', 'test', 'production']),
|
|
})
|
|
|
|
const env = envSchema.safeParse(process.env)
|
|
|
|
if (!env.success) {
|
|
throw new Error(
|
|
'❌ Invalid environment variables: ' +
|
|
JSON.stringify(env.error.format(), null, 4),
|
|
)
|
|
}
|
|
module.exports.env = env.data
|