Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/prod-stg-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}} \
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
11 changes: 8 additions & 3 deletions env.config.js
Original file line number Diff line number Diff line change
@@ -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-dev.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 = {
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion templates/search/results.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down