From 4cfea768ad1535214a7c025260dcee85decfcaf4 Mon Sep 17 00:00:00 2001 From: ekachxaidze98 Date: Fri, 5 Jun 2026 17:31:22 +0400 Subject: [PATCH 1/2] CORE: add stg test --- env.config.js | 2 +- templates/search/results.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/env.config.js b/env.config.js index 2f45da02..9eedcb59 100644 --- a/env.config.js +++ b/env.config.js @@ -5,7 +5,7 @@ const local = { } const development = { - API_URL: 'https://api-dev.core.ac.uk/internal', + API_URL: 'https://api-stg.core.ac.uk/internal/', } const production = { diff --git a/templates/search/results.jsx b/templates/search/results.jsx index c97ce44f..1c314e28 100644 --- a/templates/search/results.jsx +++ b/templates/search/results.jsx @@ -24,7 +24,7 @@ const Results = ({ works, searchId }) => thumbnail_m: thumbnailLink, display: displayLink, }) => { - const memberType = checkType(dataProviders?.[0].id) + const memberType = checkType(dataProviders?.[0]?.id) const fullTextLink = links.find((l) => l.type === 'download')?.url const metadataLink = links.find((l) => l.type === 'display')?.url const router = useRouter() From fe69cdc345fdecf7b97ccec6798b2b584973954f Mon Sep 17 00:00:00 2001 From: ekachxaidze98 Date: Fri, 5 Jun 2026 18:09:05 +0400 Subject: [PATCH 2/2] CORE: add docker test --- .github/workflows/prod-stg-deploy.yml | 6 ++++-- Dockerfile | 4 +++- env.config.js | 11 ++++++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/prod-stg-deploy.yml b/.github/workflows/prod-stg-deploy.yml index c391f711..3dc1bcdd 100644 --- a/.github/workflows/prod-stg-deploy.yml +++ b/.github/workflows/prod-stg-deploy.yml @@ -135,12 +135,14 @@ jobs: shell: bash run: | if [[ "${{ steps.vars.outputs.deploy_env }}" == "staging" ]]; then - INSTALL_DEV=true + APP_ENV="staging" else - INSTALL_DEV=false + APP_ENV="production" fi docker build \ + --build-arg APP_ENV="$APP_ENV" \ + --build-arg BUILD_TARGET="${{ env.BUILD_TARGET }}" \ --build-arg SENTRY_DSN=${{env.SENTRY_DSN}} \ --build-arg GA_TRACKING_CODE=${{secrets.GA_TRACKING_CODE}} \ --build-arg ICONS_PUBLIC_PATH=${{env.ICONS_PUBLIC_PATH}} \ diff --git a/Dockerfile b/Dockerfile index 44b7ce7c..f3a213cb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ FROM node:18-alpine ARG BUILD_TARGET=azure +ARG APP_ENV=production ARG SENTRY_DSN ARG NODE_ENV=production ARG NPM_TOKEN @@ -13,7 +14,8 @@ ENV SENTRY_DSN=$SENTRY_DSN \ GA_TRACKING_CODE=$GA_TRACKING_CODE \ API_KEY=$API_KEY \ ICONS_PUBLIC_PATH=$ICONS_PUBLIC_PATH \ - BUILD_TARGET=$BUILD_TARGET + BUILD_TARGET=$BUILD_TARGET \ + APP_ENV=$APP_ENV WORKDIR /app diff --git a/env.config.js b/env.config.js index 9eedcb59..a100a0a1 100644 --- a/env.config.js +++ b/env.config.js @@ -1,11 +1,16 @@ const NODE_ENV = process.env.NODE_ENV || 'development' +const APP_ENV = process.env.APP_ENV || NODE_ENV const local = { API_URL: 'http://127.0.0.1:8000/internal', } const development = { - API_URL: 'https://api-stg.core.ac.uk/internal/', + API_URL: 'https://api-stg.core.ac.uk/internal', +} + +const staging = { + API_URL: 'https://api-stg.core.ac.uk/internal', } const production = { @@ -17,10 +22,10 @@ const validate = (config) => if (config[param] == null) throw new Error(`${param} is not configured.`) }) -const env = { local, development, production } +const env = { local, development, staging, production } const config = { ...env.production, - ...env[NODE_ENV], + ...(env[APP_ENV] || {}), API_KEY: process.env.API_KEY, SENTRY_DSN: process.env.SENTRY_DSN, GA_TRACKING_CODE: process.env.GA_TRACKING_CODE,