diff --git a/charts/fin-pay-transparency/charts/frontend/templates/deployment.yaml b/charts/fin-pay-transparency/charts/frontend/templates/deployment.yaml index 7a7a8baa9..f9526009b 100644 --- a/charts/fin-pay-transparency/charts/frontend/templates/deployment.yaml +++ b/charts/fin-pay-transparency/charts/frontend/templates/deployment.yaml @@ -45,6 +45,8 @@ spec: value: http://{{ .Release.Name }}-backend - name: LOG_LEVEL value: {{ .Values.env.logLevel }} + - name: SNOWPLOW_URL + value: {{ .Values.env.snowplowUrl }} ports: - name: http containerPort: {{ .Values.service.targetPort }} diff --git a/charts/fin-pay-transparency/values-prod.yaml b/charts/fin-pay-transparency/values-prod.yaml index 8f22aaff3..a47c4ab96 100644 --- a/charts/fin-pay-transparency/values-prod.yaml +++ b/charts/fin-pay-transparency/values-prod.yaml @@ -124,6 +124,7 @@ frontend: memory: 50Mi env: logLevel: info + snowplowUrl: spt.apps.gov.bc.ca autoscaling: enabled: true minReplicas: 3 diff --git a/charts/fin-pay-transparency/values.yaml b/charts/fin-pay-transparency/values.yaml index 808d42654..67bcd08b5 100644 --- a/charts/fin-pay-transparency/values.yaml +++ b/charts/fin-pay-transparency/values.yaml @@ -124,6 +124,7 @@ frontend: memory: 50Mi env: logLevel: info + snowplowUrl: spm.apps.gov.bc.ca autoscaling: enabled: true minReplicas: 3 diff --git a/frontend/.gitignore b/frontend/.gitignore index b22e2b50f..463fbddbf 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -26,4 +26,4 @@ local.* /blob-report/ /playwright/ .env.playwright -user.json \ No newline at end of file +user.json diff --git a/frontend/Caddyfile b/frontend/Caddyfile index 7f5a3ce56..e21ca253d 100644 --- a/frontend/Caddyfile +++ b/frontend/Caddyfile @@ -14,11 +14,17 @@ } level {$LOG_LEVEL} } + handle /env.js { + header { + Content-Type text/javascript + } + respond `window.config = {"SNOWPLOW_URL":"{$SNOWPLOW_URL}"};` + } root * /app/dist encode zstd gzip file_server @spa_router { - not path /api/* + not path /api/* /env.js file { try_files {path} /index.html } diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 69f3370b5..c0de6a9b3 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,6 +1,5 @@ # Build static files FROM node:lts-alpine AS build - WORKDIR /app COPY . . RUN npm ci --ignore-scripts && \ diff --git a/frontend/index.html b/frontend/index.html index a4edea987..552091ad3 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -10,6 +10,7 @@ +