Add env variable to set path prefix (#706)

* Add env variable to set path prefix

- When routing traffic to our new URL, the path prefix needs to be blank
- adding path prefix to be set by env var to yml files

* Update reference to env var in PATH_PREFIX

* Update PR message URL with CDN

- The actual website will point to the base url CDN
This commit is contained in:
Vim 2021-09-17 11:52:27 -07:00 committed by GitHub
commit a532b652b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 3 deletions

View file

@ -32,6 +32,7 @@ jobs:
run: npm run build --if-present
env:
DATA_SOURCE: development
PATH_PREFIX: ""
- name: Get directory contents
run: ls -la public
- name: Lint
@ -85,7 +86,7 @@ jobs:
with:
message: |
**🚢 PR Deployed! 🚢**
Find it here: https://d2zjid6n5ja2pt.cloudfront.net/justice40-tool/${{env.DESTINATION_FOLDER}}/en/cejst/ !
Find it here: https://d2zjid6n5ja2pt.cloudfront.net/ !
repo-token: ${{ secrets.GITHUB_TOKEN }}
repo-token-user-login: "github-actions[bot]" # The user.login for temporary GitHub tokens
allow-repeats: false # This is the default
@ -93,4 +94,4 @@ jobs:
run: |
echo "Github pages: https://usds.github.io/justice40-tool/$DESTINATION_FOLDER/en"
echo "Standard S3 bucket version (http only) : http://usds-geoplatform-justice40-website.s3-website-us-east-1.amazonaws.com/justice40-tool/$DESTINATION_FOLDER/en"
echo "Cloudfront https: https://d2zjid6n5ja2pt.cloudfront.net/justice40-tool/$DESTINATION_FOLDER/en"
echo "Cloudfront https: https://d2zjid6n5ja2pt.cloudfront.net"

View file

@ -30,7 +30,9 @@ jobs:
- name: Build
run: npm run build --if-present
env:
# Todo update this to env
DATA_SOURCE: development
PATH_PREFIX: "/justice40-tool/${{env.DESTINATION_FOLDER}}"
- name: Get directory contents
run: ls -la public
- name: Lint

View file

@ -7,7 +7,7 @@ module.exports = {
title: 'Justice40',
image: '/static/favicon.ico',
},
pathPrefix: `/justice40-tool/${process.env.DESTINATION_FOLDER}`,
pathPrefix: `${process.env.PATH_PREFIX}`,
plugins: [
{
resolve: 'gatsby-plugin-sass',

View file

@ -8,6 +8,7 @@ interface IZoomWarningProps {
zoomLevel: number
}
// Update this file to trigger build
const ZoomWarning = ({zoomLevel}: IZoomWarningProps) => {
return (
<>