From be687c5f01139664ad051d25f5ded8615cdb89df Mon Sep 17 00:00:00 2001 From: VWSCoronaDashboard28 Date: Thu, 5 Jan 2023 12:53:49 +0100 Subject: [PATCH] task: Added new environment variable for the staging environment URL. Removed the hardcoded staging URL. Updated the DockerFile and the example env file. --- Dockerfile | 2 ++ packages/app/.env.local.example | 3 ++- packages/app/src/locale/use-lokalize-text.tsx | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1b7e7cf337..33ed9255e1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -59,6 +59,7 @@ ARG ARG_NEXT_PUBLIC_COMMIT_ID ARG ARG_NEXT_PUBLIC_PHASE="production" ARG ARG_NEXT_PUBLIC_HOT_RELOAD_LOKALIZE=0 ARG ARG_API_URL +ARG ARG_NEXT_HOST_URL_STG ENV NEXT_PUBLIC_SANITY_DATASET=$ARG_NEXT_PUBLIC_SANITY_DATASET ENV NEXT_PUBLIC_SANITY_PROJECT_ID=$ARG_NEXT_PUBLIC_SANITY_PROJECT_ID @@ -66,6 +67,7 @@ ENV NEXT_PUBLIC_COMMIT_ID=$ARG_NEXT_PUBLIC_COMMIT_ID ENV NEXT_PUBLIC_PHASE=$ARG_NEXT_PUBLIC_PHASE ENV NEXT_PUBLIC_HOT_RELOAD_LOKALIZE=ARG_NEXT_PUBLIC_HOT_RELOAD_LOKALIZE ENV API_URL=$ARG_API_URL +ENV NEXT_HOST_URL_STG=$ARG_NEXT_HOST_URL_STG # Layer that always gets executed FROM builder diff --git a/packages/app/.env.local.example b/packages/app/.env.local.example index be30f17fdc..8ae13dfaa2 100644 --- a/packages/app/.env.local.example +++ b/packages/app/.env.local.example @@ -6,8 +6,9 @@ DISABLE_SITEMAP=true NEXT_PUBLIC_SANITY_DATASET=development NEXT_PUBLIC_SANITY_PROJECT_ID=5mog5ask +NEXT_HOST_URL_STG= SANITY_API_TOKEN= SANITY_PREVIEW_SECRET= # set content of version string -NEXT_PUBLIC_COMMIT_ID=n/a +NEXT_PUBLIC_COMMIT_ID=n/a \ No newline at end of file diff --git a/packages/app/src/locale/use-lokalize-text.tsx b/packages/app/src/locale/use-lokalize-text.tsx index e5108700a0..0c6d2983fd 100644 --- a/packages/app/src/locale/use-lokalize-text.tsx +++ b/packages/app/src/locale/use-lokalize-text.tsx @@ -21,7 +21,7 @@ export type Dataset = typeof datasets[number]; const query = `*[_type == 'lokalizeText']`; const enableHotReload = process.env.NEXT_PUBLIC_PHASE === 'develop'; -export const IS_STAGING_ENV = typeof window !== 'undefined' && window.location.host === 'staging.coronadashboard.rijksoverheid.nl'; +export const IS_STAGING_ENV = typeof window !== 'undefined' && window.location.host === process.env.NEXT_HOST_URL_STG; /** * This hook will return an object which contains all lokalize translations.