diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 17a7cdc69..0e112f235 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -99,6 +99,7 @@ jobs: SLACK_WEBHOOK_CIRCLECI_NOTIFICATIONS: ${{ secrets.SLACK_WEBHOOK_CIRCLECI_NOTIFICATIONS }} # TODO: rename or replace SLACK_WEBHOOK_ENGINEERING: ${{ secrets.SLACK_WEBHOOK_ENGINEERING }} SLACK_WEBHOOK_MODS: ${{ secrets.SLACK_WEBHOOK_MODS }} + RADISH_URL: ${{ vars.RADISH_URL }} - name: integration tests if: ${{ env.SCRATCH_SHOULD_DEPLOY == 'true' }} run: | diff --git a/bin/configure-fastly.js b/bin/configure-fastly.js index 3fec0a330..2508a7477 100644 --- a/bin/configure-fastly.js +++ b/bin/configure-fastly.js @@ -7,6 +7,7 @@ const routeJson = require('../src/routes.json'); const FASTLY_SERVICE_ID = process.env.FASTLY_SERVICE_ID || ''; const S3_BUCKET_NAME = process.env.S3_BUCKET_NAME || ''; +const RADISH_URL = process.env.RADISH_URL || ''; const fastly = require('./lib/fastly-extended')(process.env.FASTLY_API_KEY, FASTLY_SERVICE_ID); @@ -18,7 +19,15 @@ const extraAppRoutes = [ '/[^/]*.html$' ]; -const routes = routeJson.map( +const routeJsonPreProcessed = routeJson.map( + (route) => { + if (route.redirect) { + route.redirect.replace('RADISH_URL',RADISH_URL); + } + return route; + } +); +const routes = routeJsonPreProcessed.map( route => defaults({}, {pattern: fastlyConfig.expressPatternToRegex(route.pattern)}, route) ); diff --git a/src/routes.json b/src/routes.json index f912c98ac..3890f5d1d 100644 --- a/src/routes.json +++ b/src/routes.json @@ -3,7 +3,7 @@ "name": "about", "pattern": "^/about/?$", "routeAlias": "/about/?$", - "redirect": "https://scratch.pizza/" + "redirect": "RADISH_URL/" }, { "name": "annual-report",