Skip to content

Commit

Permalink
Merge pull request #8366 from colbygk/allow_deploy_bifurcated_staging…
Browse files Browse the repository at this point in the history
…_prod

Allow RADISH_URL substitution
  • Loading branch information
colbygk authored May 21, 2024
2 parents 45a2e68 + 1934f19 commit 5913624
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
11 changes: 10 additions & 1 deletion bin/configure-fastly.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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)
);

Expand Down
2 changes: 1 addition & 1 deletion src/routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "about",
"pattern": "^/about/?$",
"routeAlias": "/about/?$",
"redirect": "https://scratch.pizza/"
"redirect": "RADISH_URL/"
},
{
"name": "annual-report",
Expand Down

0 comments on commit 5913624

Please sign in to comment.