From 591c4557c02b90e107f0ce0bc6eccceee26909ef Mon Sep 17 00:00:00 2001 From: giancarlo Date: Wed, 1 May 2024 18:59:18 +0700 Subject: [PATCH] Update environment variable references Environment variables in multiple files have been updated to correctly reference public variables. Moreover, the conditional check for MONITORING_INSTRUMENTATION_ENABLED has been corrected to explicitly check for the string 'true'. This change ensures that our application correctly accesses public environmental variables and behaves as expected under the conditions defined by these variables. --- apps/web/.env.production | 2 +- apps/web/instrumentation.ts | 2 +- packages/cms/keystatic/src/keystatic.config.ts | 2 +- packages/monitoring/api/src/instrumentation.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/web/.env.production b/apps/web/.env.production index fb76f0bbc..e7f400b5c 100644 --- a/apps/web/.env.production +++ b/apps/web/.env.production @@ -12,5 +12,5 @@ NEXT_PUBLIC_SUPABASE_URL= NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY= # MONITORING -MONITORING_PROVIDER= +NEXT_PUBLIC_MONITORING_PROVIDER= MONITORING_INSTRUMENTATION_ENABLED=false diff --git a/apps/web/instrumentation.ts b/apps/web/instrumentation.ts index f15910dc6..9f751880c 100644 --- a/apps/web/instrumentation.ts +++ b/apps/web/instrumentation.ts @@ -7,7 +7,7 @@ export async function register() { // only run in nodejs runtime if ( process.env.NEXT_RUNTIME === 'nodejs' && - process.env.MONITORING_INSTRUMENTATION_ENABLED + process.env.MONITORING_INSTRUMENTATION_ENABLED === 'true' ) { const { registerMonitoringInstrumentation } = await import( '@kit/monitoring/instrumentation' diff --git a/packages/cms/keystatic/src/keystatic.config.ts b/packages/cms/keystatic/src/keystatic.config.ts index 83fc670c5..e2c3e3360 100644 --- a/packages/cms/keystatic/src/keystatic.config.ts +++ b/packages/cms/keystatic/src/keystatic.config.ts @@ -30,7 +30,7 @@ const storage = z.union([local, cloud, github]).parse({ pathPrefix: process.env.KEYSTATIC_PATH_PREFIX, }); -const path = process.env.KEYSTATIC_CONTENT_PATH ?? 'content'; +const path = process.env.NEXT_PUBLIC_KEYSTATIC_CONTENT_PATH ?? './content'; const keyStaticConfig = createKeyStaticConfig(path); diff --git a/packages/monitoring/api/src/instrumentation.ts b/packages/monitoring/api/src/instrumentation.ts index b32a6f940..f6b8efc90 100644 --- a/packages/monitoring/api/src/instrumentation.ts +++ b/packages/monitoring/api/src/instrumentation.ts @@ -35,7 +35,7 @@ export async function registerMonitoringInstrumentation() { default: throw new Error( - `Unknown instrumentation provider: ${process.env.MONITORING_PROVIDER}`, + `Unknown instrumentation provider: ${process.env.NEXT_PUBLIC_MONITORING_PROVIDER}`, ); } }