Skip to content

Commit

Permalink
Merge pull request #72 from bcgov/feat/global-env-var
Browse files Browse the repository at this point in the history
Feature: Implement global meta environment variable
  • Loading branch information
hannah-macdonald1 authored Jan 23, 2025
2 parents fc8aca8 + fc99584 commit 29054f0
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
NODE_ENV=production
VPI_APP_ENV='dev/test/prod'

RECORD_CACHE_MS = 60000

Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/build-and-push-ghcr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ jobs:
value: ${{ secrets.APS_NAMESPACE }}
commitChange: false

- name: 'YAML poke: Set App Environment'
uses: fjogeleit/yaml-update-action@v0.15.0
with:
valueFile: 'helm/values.yaml'
propertyPath: 'vpiAppEnv'
value: ${{ vars.VPI_APP_ENV }}
commitChange: false

- name: 'YAML poke: Set build number'
uses: fjogeleit/yaml-update-action@v0.15.0
with:
Expand Down
2 changes: 2 additions & 0 deletions helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,6 @@ spec:
key: INCIDENT_RESTRICTED_FIELD
- name: VPI_APP_LABEL
value: {{ .Values.vpiAppBuildLabel.version }}
- name: VPI_APP_ENV
value: {{ .Values.vpiAppEnv }}
restartPolicy: Always
2 changes: 2 additions & 0 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ tolerations: []

affinity: {}

vpiAppEnv: '<set by CI/CD>'

aps:
namespace: '<set by CI/CD>'

Expand Down
10 changes: 8 additions & 2 deletions src/configuration/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,14 @@ export default () => ({
cases: process.env.CASE_SINCE_FIELD ?? undefined,
incidents: process.env.INCIDENT_SINCE_FIELD ?? undefined,
},
skipAuthGuard: process.env.SKIP_AUTH_GUARD === 'true',
skipJWTCache: process.env.SKIP_JWT_CACHE === 'true',
skipAuthGuard:
process.env.VPI_APP_ENV === 'prod'
? false
: process.env.SKIP_AUTH_GUARD === 'true',
skipJWTCache:
process.env.VPI_APP_ENV === 'prod'
? false
: process.env.SKIP_JWT_CACHE === 'true',
endpointUrls: {
baseUrl: process.env.UPSTREAM_BASE_URL ?? ' ',
supportNetwork: process.env.SUPPORT_NETWORK_ENDPOINT ?? ' ',
Expand Down

0 comments on commit 29054f0

Please sign in to comment.