Ajout du support des review apps pour l'api

pull/2163/head
Jérémy Rialland 2022-06-08 11:03:14 +02:00 committed by Johan Girod
parent 4715df3a5a
commit ff2b3bf207
4 changed files with 9 additions and 5 deletions

View File

@ -21,6 +21,7 @@ jobs:
runs-on: ubuntu-18.04
outputs:
env-name: ${{ steps.deploy-env.outputs.name }}
api_url: ${{ steps.base-urls.outputs.api }}
fr_url: ${{ steps.base-urls.outputs.fr }}
en_url: ${{ steps.base-urls.outputs.en }}
steps:
@ -28,12 +29,14 @@ jobs:
run: echo "::set-output name=name::${{ github.event.number || '${GITHUB_REF#refs/*/}' }}"
- id: base-urls
run:
echo "::set-output name=api::${{ steps.deploy-env.outputs.name == 'master' && 'https://mon-entreprise-api.osc-fr1.scalingo.io' || format('https://mon-entreprise-api-pr{0}.osc-fr1.scalingo.io', steps.deploy-env.outputs.name) }}";
echo "::set-output name=fr::${{ steps.deploy-env.outputs.name == 'master' && 'https://mon-entreprise.urssaf.fr' || format('https://{0}--mon-entreprise.netlify.app', steps.deploy-env.outputs.name) }}";
echo "::set-output name=en::${{ steps.deploy-env.outputs.name == 'master' && 'https://mycompanyinfrance.urssaf.fr' || format('https://{0}-en--mon-entreprise.netlify.app', steps.deploy-env.outputs.name) }}";
build:
needs: deploy-context
env:
API_BASE_URL: ${{ needs.deploy-context.outputs.api_url }}
VITE_FR_BASE_URL: ${{ needs.deploy-context.outputs.fr_url }}
VITE_EN_BASE_URL: ${{ needs.deploy-context.outputs.en_url }}
runs-on: ubuntu-18.04
@ -62,6 +65,7 @@ jobs:
yarn workspace site build:prerender
- name: Replace site placeholders in netlify.toml redirection file
run: |
sed -i "s|:API_URL|$API_BASE_URL|g" site/netlify.toml;
sed -i "s|:SITE_FR|$VITE_FR_BASE_URL|g" site/netlify.toml;
sed -i "s|:SITE_EN|$VITE_EN_BASE_URL|g" site/netlify.toml;
- name: Update Algolia index

View File

@ -17,7 +17,7 @@
"validate": "yarn swagger-cli validate ./source/openapi.yaml",
"postinstall": "yarn build:openapi",
"start": "yarn clean && yarn build:watch & wait-on ./dist && nodemon -d 1s ./dist/",
"start:prod": "nodemon -d 500ms -w ./dist/index.js -x 'node ./dist/index.js || touch ./dist/index.js'",
"start:prod": "NODE_ENV=production nodemon -d 500ms -w ./dist/index.js -x 'node ./dist/index.js || touch ./dist/index.js'",
"build": "yarn build:openapi && yarn build:ts",
"build:watch": "yarn build:openapi:watch & yarn wait:openapi && yarn build:ts:watch",
"build:ts": "tsc",

View File

@ -1,12 +1,12 @@
[[headers]]
for = "/*"
[headers.values]
Content-Security-Policy = "default-src 'self' mon-entreprise.fr; style-src 'self' 'unsafe-inline' mon-entreprise.zammad.com; connect-src 'self' *.incubateur.net raw.githubusercontent.com tm.urssaf.fr mon-entreprise.zammad.com api.recherche-entreprises.fabrique.social.gouv.fr geo.api.gouv.fr *.algolia.net *.algolianet.com; form-action 'self' *.sibforms.com *.incubateur.net mon-entreprise.zammad.com; script-src 'self' 'unsafe-inline' 'unsafe-eval' tm.urssaf.fr *.incubateur.net stonly.com code.jquery.com mon-entreprise.zammad.com polyfill.io; img-src 'self' data: tm.urssaf.fr user-images.githubusercontent.com; frame-src 'self' https://www.youtube-nocookie.com https://codesandbox.io https://place-des-entreprises.beta.gouv.fr https://reso-staging.osc-fr1.scalingo.io"
Content-Security-Policy = "default-src 'self' mon-entreprise.fr; style-src 'self' 'unsafe-inline' mon-entreprise.zammad.com; connect-src 'self' *.incubateur.net raw.githubusercontent.com tm.urssaf.fr mon-entreprise.zammad.com api.recherche-entreprises.fabrique.social.gouv.fr geo.api.gouv.fr *.algolia.net *.algolianet.com; form-action 'self' *.sibforms.com *.incubateur.net mon-entreprise.zammad.com; script-src 'self' 'unsafe-inline' 'unsafe-eval' tm.urssaf.fr *.incubateur.net stonly.com code.jquery.com mon-entreprise.zammad.com polyfill.io; img-src 'self' data: tm.urssaf.fr user-images.githubusercontent.com; frame-src 'self' https://www.youtube-nocookie.com https://codesandbox.io https://place-des-entreprises.beta.gouv.fr https://reso-staging.osc-fr1.scalingo.io https://stackblitz.com"
## Scalingo proxy for API
[[redirects]]
from = "/api/*"
to = "https://mon-entreprise-api.osc-fr1.scalingo.io/api/:splat"
to = ":API_URL/api/:splat"
status = 200
## Twemoji proxy for client privacy #1219

View File

@ -27,8 +27,8 @@
"build:prerender": "node prerender.cjs",
"build:iframe-script": "NODE_OPTIONS='--max-old-space-size=4096'; vite build --config vite-iframe-script.config.ts",
"build:preview": "VITE_FR_BASE_URL=http://localhost:8888; VITE_EN_BASE_URL=http://localhost:8889; yarn build && yarn build:ssr && yarn build:prerender",
"preview:mon-entreprise": "sed 's|:SITE_FR||g' netlify.toml > dist/netlify.toml && cd dist && npx netlify-cli dev -p 8888",
"preview:infrance": "sed 's|:SITE_EN||g' netlify.toml > dist/netlify.toml && cd dist && npx netlify-cli dev -p 8889",
"preview:mon-entreprise": "sed 's|:SITE_FR||g' netlify.toml | sed 's|:API_URL|http://localhost:3004|g' > dist/netlify.toml && cd dist && npx netlify-cli dev -d ./ -p 8888",
"preview:infrance": "sed 's|:SITE_EN||g' | sed 's|:API_URL|http://localhost:3004|g' netlify.toml > dist/netlify.toml && cd dist && npx netlify-cli dev -d ./ -p 8889",
"typecheck:watch": "tsc --skipLibCheck --noEmit --watch",
"test": "vitest",
"test:dev-e2e:mon-entreprise": "cypress open --browser chromium",