From e063020ed146431a9ab6777329f6bd46661e3f5a Mon Sep 17 00:00:00 2001 From: andres Date: Fri, 10 May 2024 12:57:38 +0200 Subject: [PATCH] add api key --- src/env/client.mjs | 6 +++--- src/env/server.mjs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/env/client.mjs b/src/env/client.mjs index 30958cb..107c6d3 100644 --- a/src/env/client.mjs +++ b/src/env/client.mjs @@ -5,7 +5,7 @@ const _clientEnv = clientSchema.safeParse(clientEnv); export const formatErrors = ( /** @type {import('zod').ZodFormattedError,string>} */ - errors, + errors ) => Object.entries(errors) .map(([name, value]) => { @@ -17,7 +17,7 @@ export const formatErrors = ( if (!_clientEnv.success) { console.error( "❌ Invalid environment variables:\n", - ...formatErrors(_clientEnv.error.format()), + ...formatErrors(_clientEnv.error.format()) ); throw new Error("Invalid environment variables"); } @@ -25,7 +25,7 @@ if (!_clientEnv.success) { for (let key of Object.keys(_clientEnv.data)) { if (!key.startsWith("NEXT_PUBLIC_")) { console.warn( - `❌ Invalid public environment variable name: ${key}. It must begin with 'NEXT_PUBLIC_'`, + `❌ Invalid public environment variable name: ${key}. It must begin with 'NEXT_PUBLIC_'` ); throw new Error("Invalid public environment variable name"); diff --git a/src/env/server.mjs b/src/env/server.mjs index 736e3a6..9e69ae4 100644 --- a/src/env/server.mjs +++ b/src/env/server.mjs @@ -3,15 +3,15 @@ * This file is included in `/next.config.mjs` which ensures the app isn't built with invalid env vars. * It has to be a `.mjs`-file to be imported there. */ -import { serverSchema } from "./schema.mjs"; import { env as clientEnv, formatErrors } from "./client.mjs"; +import { serverSchema } from "./schema.mjs"; const _serverEnv = serverSchema.safeParse(process.env); if (!_serverEnv.success) { console.error( "❌ Invalid environment variables:\n", - ...formatErrors(_serverEnv.error.format()), + ...formatErrors(_serverEnv.error.format()) ); throw new Error("Invalid environment variables"); }