Skip to content

Commit

Permalink
fix missing vars and file hash encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
Frizi committed Oct 21, 2024
1 parent dda5762 commit bd24585
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 20 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/bazel-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ jobs:
- name: Expose env variables
run: |
cat << END > app/gui/.env.production
VITE_ENVIRONMENT="${{ vars.ENSO_CLOUD_ENVIRONMENT }}"
VITE_API_URL="${{ vars.ENSO_CLOUD_API_URL }}"
VITE_CHAT_URL="${{ vars.ENSO_CLOUD_CHAT_URL }}"
VITE_COGNITO_DOMAIN="${{ vars.ENSO_CLOUD_COGNITO_DOMAIN }}"
VITE_COGNITO_REGION="${{ vars.ENSO_CLOUD_COGNITO_REGION }}"
VITE_COGNITO_USER_POOL_ID="${{ vars.ENSO_CLOUD_COGNITO_USER_POOL_ID }}"
VITE_COGNITO_USER_POOL_WEB_CLIENT_ID="${{ vars.ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID }}"
VITE_ENVIRONMENT="${{ vars.ENSO_CLOUD_ENVIRONMENT }}"
VITE_GOOGLE_ANALYTICS_TAG="${{ vars.ENSO_CLOUD_GOOGLE_ANALYTICS_TAG }}"
VITE_SENTRY_DSN="${{ vars.ENSO_CLOUD_SENTRY_DSN }}"
VITE_STRIPE_KEY="${{ vars.ENSO_CLOUD_STRIPE_KEY }}"
VITE_ENSO_AG_GRID_LICENSE_KEY="${{ vars.ENSO_AG_GRID_LICENSE_KEY }}"
VITE_ENSO_MAPBOX_API_TOKEN="${{ vars.ENSO_MAPBOX_API_TOKEN }}"
VITE_DASHBOARD_COMMIT_HASH="${{ github.sha }}"
VITE_DASHBOARD_VERSION="SNAPSHOT-${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
VITE_COMMIT_HASH="${{ github.sha }}"
VITE_VERSION="SNAPSHOT-${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
VITE_CLOUD_BUILD="false"
END
- run: bazel build //app/gui:dist
Expand Down
6 changes: 4 additions & 2 deletions app/gui/.env.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Bazel build step defaults to having all envs left as placeholders, so that they can be replaced late after the vite build step.
VITE_ENVIRONMENT = "((%__VITE_ENVIRONMENT__%))"
VITE_API_URL = "((%__VITE_API_URL__%))"
VITE_SENTRY_DSN = "((%__VITE_SENTRY_DSN__%))"
VITE_STRIPE_KEY = "((%__VITE_STRIPE_KEY__%))"
Expand All @@ -7,8 +8,9 @@ VITE_COGNITO_USER_POOL_ID = "((%__VITE_COGNITO_USER_POOL_ID__%))"
VITE_COGNITO_USER_POOL_WEB_CLIENT_ID = "((%__VITE_COGNITO_USER_POOL_WEB_CLIENT_ID__%))"
VITE_COGNITO_DOMAIN = "((%__VITE_COGNITO_DOMAIN__%))"
VITE_COGNITO_REGION = "((%__VITE_COGNITO_REGION__%))"
VITE_DASHBOARD_VERSION = "((%__VITE_DASHBOARD_VERSION__%))"
VITE_DASHBOARD_COMMIT_HASH = "((%__VITE_DASHBOARD_COMMIT_HASH__%))"
VITE_VERSION = "((%__VITE_VERSION__%))"
VITE_COMMIT_HASH = "((%__VITE_COMMIT_HASH__%))"
VITE_CLOUD_BUILD = "((%__VITE_CLOUD_BUILD__%))"
VITE_GOOGLE_ANALYTICS_TAG = "((%__ENSO_CLOUD_GOOGLE_ANALYTICS_TAG__%))"
VITE_ENSO_AG_GRID_LICENSE_KEY = "((%__VITE_ENSO_AG_GRID_LICENSE_KEY__%))"
VITE_ENSO_MAPBOX_API_TOKEN = "((%__VITE_ENSO_MAPBOX_API_TOKEN__%))"
2 changes: 1 addition & 1 deletion app/gui/scripts/envReplacer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ async function updateHashInFilename(projectPath, fileContents) {
const contentHash = createHash('sha256')
.update(fileContents)
.digest()
.toString('base64')
.toString('base64url')
.substring(0, oldHash.length)
return `-${contentHash}.${ext}`
})
Expand Down
28 changes: 14 additions & 14 deletions app/gui/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@
*/
const $config = {
ENVIRONMENT: import.meta.env.MODE,
API_URL: import.meta.env.API_URL,
SENTRY_DSN: import.meta.env.SENTRY_DSN,
STRIPE_KEY: import.meta.env.STRIPE_KEY,
CHAT_URL: import.meta.env.CHAT_URL,
COGNITO_USER_POOL_ID: import.meta.env.COGNITO_USER_POOL_ID,
COGNITO_USER_POOL_WEB_CLIENT_ID: import.meta.env.COGNITO_USER_POOL_WEB_CLIENT_ID,
GOOGLE_ANALYTICS_TAG: import.meta.env.GOOGLE_ANALYTICS_TAG,
COGNITO_DOMAIN: import.meta.env.COGNITO_DOMAIN,
COGNITO_REGION: import.meta.env.COGNITO_REGION,
VERSION: import.meta.env.VERSION,
COMMIT_HASH: import.meta.env.COMMIT_HASH,
PROJECT_MANAGER_URL: import.meta.env.DEV_PROJECT_MANAGER_URL,
YDOC_SERVER_URL: import.meta.env.YDOC_SERVER_URL,
CLOUD_BUILD: import.meta.env.CLOUD_BUILD,
API_URL: import.meta.env.VITE_API_URL,
SENTRY_DSN: import.meta.env.VITE_SENTRY_DSN,
STRIPE_KEY: import.meta.env.VITE_STRIPE_KEY,
CHAT_URL: import.meta.env.VITE_CHAT_URL,
COGNITO_USER_POOL_ID: import.meta.env.VITE_COGNITO_USER_POOL_ID,
COGNITO_USER_POOL_WEB_CLIENT_ID: import.meta.env.VITE_COGNITO_USER_POOL_WEB_CLIENT_ID,
GOOGLE_ANALYTICS_TAG: import.meta.env.VITE_GOOGLE_ANALYTICS_TAG,
COGNITO_DOMAIN: import.meta.env.VITE_COGNITO_DOMAIN,
COGNITO_REGION: import.meta.env.VITE_COGNITO_REGION,
VERSION: import.meta.env.VITE_VERSION,
COMMIT_HASH: import.meta.env.VITE_COMMIT_HASH,
PROJECT_MANAGER_URL: import.meta.env.VITE_DEV_PROJECT_MANAGER_URL,
YDOC_SERVER_URL: import.meta.env.VITE_YDOC_SERVER_URL,
CLOUD_BUILD: import.meta.env.VITE_CLOUD_BUILD,
AG_GRID_LICENSE_KEY: import.meta.env.VITE_ENSO_AG_GRID_LICENSE_KEY,
MAPBOX_API_TOKEN: import.meta.env.VITE_ENSO_MAPBOX_API_TOKEN,
} as const
Expand Down

0 comments on commit bd24585

Please sign in to comment.