From 72aff470e9cef03ba509fe437fd9ef6dec90204a Mon Sep 17 00:00:00 2001 From: Claas Augner Date: Mon, 13 Nov 2023 11:57:23 +0100 Subject: [PATCH] chore(placement): switch to BSA --- .github/workflows/prod-build.yml | 4 ++-- .github/workflows/stage-build.yml | 1 - cloud-function/README.md | 5 ++--- cloud-function/src/env.ts | 3 +-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/prod-build.yml b/.github/workflows/prod-build.yml index 7a645f9848fb..eaca33facab7 100644 --- a/.github/workflows/prod-build.yml +++ b/.github/workflows/prod-build.yml @@ -355,6 +355,7 @@ 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 }}" \ @@ -362,8 +363,7 @@ jobs: --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 diff --git a/.github/workflows/stage-build.yml b/.github/workflows/stage-build.yml index fa98f4b363fa..3b07ab524832 100644 --- a/.github/workflows/stage-build.yml +++ b/.github/workflows/stage-build.yml @@ -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 }}" \ diff --git a/cloud-function/README.md b/cloud-function/README.md index 7eae98ab6fb7..8b7307eaba13 100644 --- a/cloud-function/README.md +++ b/cloud-function/README.md @@ -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. diff --git a/cloud-function/src/env.ts b/cloud-function/src/env.ts index adfbc6bc4a94..96716c22e705 100644 --- a/cloud-function/src/env.ts +++ b/cloud-function/src/env.ts @@ -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") );