Skip to content

Commit

Permalink
chore(placement): switch to BSA
Browse files Browse the repository at this point in the history
  • Loading branch information
caugner committed Nov 29, 2023
1 parent b77edeb commit 72aff47
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/prod-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -355,15 +355,15 @@ jobs:
--set-env-vars="ORIGIN_PLAY=mdnplay.dev" \
--set-env-vars="SOURCE_CONTENT=https://storage.googleapis.com/${{ vars.GCP_BUCKET_NAME }}/main/" \
--set-env-vars="SOURCE_API=https://api.developer.mozilla.org/" \
--set-env-vars="BSA_ENABLED=true" \
--set-env-vars="SENTRY_DSN=${{ secrets.SENTRY_DSN_CLOUD_FUNCTION }}" \
--set-env-vars="SENTRY_ENVIRONMENT=prod" \
--set-env-vars="SENTRY_TRACES_SAMPLE_RATE=${{ vars.SENTRY_TRACES_SAMPLE_RATE }}" \
--set-env-vars="SENTRY_RELEASE=${{ github.sha }}" \
--set-secrets="KEVEL_SITE_ID=projects/${{ secrets.GCP_PROJECT_NAME }}/secrets/prod-kevel-site-id/versions/latest" \
--set-secrets="KEVEL_NETWORK_ID=projects/${{ secrets.GCP_PROJECT_NAME }}/secrets/prod-kevel-network-id/versions/latest" \
--set-secrets="SIGN_SECRET=projects/${{ secrets.GCP_PROJECT_NAME }}/secrets/prod-sign-secret/versions/latest" \
--set-secrets="CARBON_ZONE_KEY=projects/${{ secrets.GCP_PROJECT_NAME }}/secrets/prod-carbon-zone-key/versions/latest" \
--set-secrets="CARBON_FALLBACK_ENABLED=projects/${{ secrets.GCP_PROJECT_NAME }}/secrets/prod-fallback-enabled/versions/latest" \
--set-secrets="BSA_ZONE_KEYS=projects/${{ secrets.GCP_PROJECT_NAME }}/secrets/prod-bsa-zone-keys/versions/latest" \
2>&1 | sed "s/^/[$region] /" &
pids+=($!)
done
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/stage-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ jobs:
--set-env-vars="SOURCE_CONTENT=https://storage.googleapis.com/${{ vars.GCP_BUCKET_NAME }}/main/" \
--set-env-vars="SOURCE_API=https://api.developer.allizom.org/" \
--set-env-vars="BSA_ENABLED=true" \
--set-env-vars="BSA_URL_PREFIX=https://developer.allizom.org/fr/" \
--set-env-vars="SENTRY_DSN=${{ secrets.SENTRY_DSN_CLOUD_FUNCTION }}" \
--set-env-vars="SENTRY_ENVIRONMENT=stage" \
--set-env-vars="SENTRY_TRACES_SAMPLE_RATE=${{ vars.SENTRY_TRACES_SAMPLE_RATE }}" \
Expand Down
5 changes: 2 additions & 3 deletions cloud-function/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ The placement handler uses the following environment variables:
- `KEVEL_NETWORK_ID` (default: `0`) - Required for serving placements via Kevel.
- `SIGN_SECRET` (default: `""`) - Required for serving placements.
- `BSA_ZONE_KEYS` (default: `""`) - Required for serving placements via BSA.
- `BSA_URL_PREFIX`(default: "https://localhost") - Where to show BSA placements
if enabled. Formatted like :
"placementname1:zonekey1;placementkey2:zonekey2...".
- `BSA_URL_PREFIX`(default: `""`) - Where to show BSA placements if enabled.
Formatted like : "placementname1:zonekey1;placementkey2:zonekey2...".
- `BSA_ENABLED` (default: `"false"`) - Whether to use placements via BSA.

You can override the defaults by adding a `.env` file with `KEY=value` lines.
3 changes: 1 addition & 2 deletions cloud-function/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ export const SIGN_SECRET = process.env["SIGN_SECRET"] ?? "";
export const BSA_ZONE_KEYS = Object.fromEntries(
(process.env["BSA_ZONE_KEYS"] ?? "").split(";").map((k) => k.split(":"))
);
export const BSA_URL_PREFIX =
process.env["BSA_URL_PREFIX"] ?? "https://localhost";
export const BSA_URL_PREFIX = process.env["BSA_URL_PREFIX"] ?? "";
export const BSA_ENABLED = Boolean(
JSON.parse(process.env["BSA_ENABLED"] || "false")
);
Expand Down

0 comments on commit 72aff47

Please sign in to comment.