mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-03-14 15:09:59 -04:00
Merge pull request #8366 from colbygk/allow_deploy_bifurcated_staging_prod
Allow RADISH_URL substitution
This commit is contained in:
commit
59136243aa
3 changed files with 12 additions and 2 deletions
1
.github/workflows/ci-cd.yml
vendored
1
.github/workflows/ci-cd.yml
vendored
|
@ -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: |
|
||||
|
|
|
@ -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)
|
||||
);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"name": "about",
|
||||
"pattern": "^/about/?$",
|
||||
"routeAlias": "/about/?$",
|
||||
"redirect": "https://scratch.pizza/"
|
||||
"redirect": "RADISH_URL/"
|
||||
},
|
||||
{
|
||||
"name": "annual-report",
|
||||
|
|
Loading…
Reference in a new issue