From 02caa66773fe6f611b53668ab3d95955917844e0 Mon Sep 17 00:00:00 2001 From: Paradoxe Ngwasi Date: Wed, 13 Dec 2023 06:32:34 +0000 Subject: [PATCH 1/2] Refactor loadNextPublicEnvs to always add process.env values --- apps/web/app/env.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/web/app/env.ts b/apps/web/app/env.ts index 1da87ec87..de9bceccb 100644 --- a/apps/web/app/env.ts +++ b/apps/web/app/env.ts @@ -52,9 +52,7 @@ export function loadNextPublicEnvs() { .filter((key) => key.startsWith('NEXT_PUBLIC')) .reduce( (acc, value) => { - if (process.env[value]) { - acc[value] = process.env[value] as string; - } + acc[value] = process.env[value] as string; return acc; }, {} as Record From a27b5a36e4a1bf5ccbfc76677a21eb88a0d294e4 Mon Sep 17 00:00:00 2001 From: Paradoxe Ngwasi Date: Wed, 13 Dec 2023 06:45:55 +0000 Subject: [PATCH 2/2] Refactor: improve env code readability and reusability --- apps/web/app/env.ts | 11 ++++------- apps/web/pages/_app.tsx | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/apps/web/app/env.ts b/apps/web/app/env.ts index de9bceccb..2de6fd64b 100644 --- a/apps/web/app/env.ts +++ b/apps/web/app/env.ts @@ -50,13 +50,10 @@ export function setNextPublicEnv(envs: Env) { export function loadNextPublicEnvs() { return Object.keys(process.env) .filter((key) => key.startsWith('NEXT_PUBLIC')) - .reduce( - (acc, value) => { - acc[value] = process.env[value] as string; - return acc; - }, - {} as Record - ); + .reduce((acc, value) => { + acc[value] = process.env[value]; + return acc; + }, {} as Env); } // Preload Some variables diff --git a/apps/web/pages/_app.tsx b/apps/web/pages/_app.tsx index e2c9b958a..790cbd7c6 100644 --- a/apps/web/pages/_app.tsx +++ b/apps/web/pages/_app.tsx @@ -117,7 +117,7 @@ MyApp.getInitialProps = async ({ Component, ctx }: { Component: NextPage