Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ VITE_API_BASE_URL=http://127.0.0.1:4242
VITE_KEYCLOAK_URL=http://localhost:8080/
VITE_KEYCLOAK_REALM=dev
VITE_KEYCLOAK_CLIENT_ID=bff-dashboard
VITE_API_MOCKING_ENABLED=false
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
groups:
all-github-actions:
patterns:
- "*"
schedule:
interval: "monthly"
day: "monday"
time: "08:30"
timezone: "Europe/Vienna"
open-pull-requests-limit: 5
labels:
- "dependencies"
- "github-actions"
assignees:
- "cleot" # devops
40 changes: 0 additions & 40 deletions .github/workflows/build.yml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI

on:
push:
branches: ["master", "dev"]
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
validate:
name: Validate (lint, test, build)
runs-on: ubuntu-latest
env:
NODE_VERSION: 22

steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

- name: Set up Node.js (${{ env.NODE_VERSION }})
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: ${{ env.NODE_VERSION }}

- name: Install dependencies
run: npm ci

- name: Lint
run: npm run lint

- name: Run tests and generate coverage
run: npm run test -- --coverage

- name: Build
run: npm run build
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI workflow's build step (line 38) runs npm run build but doesn't set any of the required VITE_* environment variables. Since the code now requires these variables at build time (via import.meta.env), and the new env.ts module uses non-null assertions on critical values, the build will likely fail or produce a broken application.

The workflow should set the necessary environment variables before the build step, even if they're just placeholder values for CI purposes:

- name: Build
  run: npm run build
  env:
    VITE_API_BASE_URL: "http://localhost"
    VITE_KEYCLOAK_URL: "http://localhost"
    VITE_KEYCLOAK_REALM: "test"
    VITE_KEYCLOAK_CLIENT_ID: "test"
Suggested change
run: npm run build
run: npm run build
env:
VITE_API_BASE_URL: "http://localhost"
VITE_KEYCLOAK_URL: "http://localhost"
VITE_KEYCLOAK_REALM: "test"
VITE_KEYCLOAK_CLIENT_ID: "test"

Copilot uses AI. Check for mistakes.

- name: Upload coverage to Codecov
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
12 changes: 6 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:

steps:
- name: Checkout ${{ github.ref_name }}
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
ref: ${{ github.ref }}
fetch-depth: 0
Expand All @@ -68,7 +68,7 @@ jobs:
echo "Validation successful: Running from 'dev' branch."

- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
Expand Down Expand Up @@ -125,7 +125,7 @@ jobs:

steps:
- name: Checkout ${{ github.ref_name }}
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
ref: ${{ github.ref }}
fetch-depth: 0
Expand All @@ -141,7 +141,7 @@ jobs:
echo "Validation successful: Running from tag '${{ github.ref_name }}'."

- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
Expand Down Expand Up @@ -219,7 +219,7 @@ jobs:

steps:
- name: Checkout ${{ github.ref_name }}
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
ref: ${{ github.ref }}
fetch-depth: 0
Expand All @@ -235,7 +235,7 @@ jobs:
echo "Validation successful: Running from tag '${{ github.ref_name }}'."

- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: build and push nightly image

on:
push:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
IMAGE_NAME: "bcr-wdc-dashboard-ui"

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

- name: Login to GHCR
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0

- id: meta
name: Metadata
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
with:
images: |
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=nightly

- id: push
name: Build & push ${{ env.IMAGE_NAME }}
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ github.repository }}/${{ env.IMAGE_NAME }}
cache-to: type=gha,mode=max,scope=${{ github.repository }}/${{ env.IMAGE_NAME }}
56 changes: 56 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: release tagged image

on:
push:
tags:
- "v*.*.*"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
IMAGE_NAME: "bcr-wdc-dashboard-ui"

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

- name: Login to GHCR
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0

- id: meta
name: Metadata
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
with:
images: |
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}

- id: push
name: Build & push ${{ env.IMAGE_NAME }}
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ github.repository }}/${{ env.IMAGE_NAME }}
cache-to: type=gha,mode=max,scope=${{ github.repository }}/${{ env.IMAGE_NAME }}
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ RUN npm run build -- --mode=${VITE_MODE}

FROM nginx:1.27.5-alpine@sha256:65645c7bb6a0661892a8b03b89d0743208a18dd2f3f17a54ef4b76fb8e2f2a10

RUN apk add --no-cache jq

COPY --from=builder /app/dist /usr/share/nginx/html

COPY docker/entrypoint.d/ /docker-entrypoint.d/
RUN chmod +x /docker-entrypoint.d/*.sh

COPY docker/nginx/snippets/proxy-params.conf /etc/nginx/snippets/proxy-params.conf
# each time nginx is started it will perform variable substition in all template
# files found in `/etc/nginx/templates/*.template`, and copy the results (without
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ services:
- VITE_KEYCLOAK_URL=${VITE_KEYCLOAK_URL}
- VITE_KEYCLOAK_REALM=${VITE_KEYCLOAK_REALM}
- VITE_KEYCLOAK_CLIENT_ID=${VITE_KEYCLOAK_CLIENT_ID}
- VITE_API_MOCKING_ENABLED=${VITE_API_MOCKING_ENABLED}
- VITE_BITCR_DEV_INCLUDE_CROWDIN_IN_CONTEXT_TOOLING=${VITE_BITCR_DEV_INCLUDE_CROWDIN_IN_CONTEXT_TOOLING}
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:80"]
interval: 30s
Expand Down
15 changes: 15 additions & 0 deletions docker/entrypoint.d/00-env-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env sh
set -e

JSON_ENV=$(jq -n \
--arg VITE_API_BASE_URL "$VITE_API_BASE_URL" \
--arg VITE_API_MOCKING_ENABLED "$VITE_API_MOCKING_ENABLED" \
--arg VITE_KEYCLOAK_URL "$VITE_KEYCLOAK_URL" \
--arg VITE_KEYCLOAK_REALM "$VITE_KEYCLOAK_REALM" \
--arg VITE_KEYCLOAK_CLIENT_ID "$VITE_KEYCLOAK_CLIENT_ID" \
--arg VITE_BITCR_DEV_INCLUDE_CROWDIN_IN_CONTEXT_TOOLING "$VITE_BITCR_DEV_INCLUDE_CROWDIN_IN_CONTEXT_TOOLING" \
'{VITE_API_BASE_URL: $VITE_API_BASE_URL, VITE_API_MOCKING_ENABLED: $VITE_API_MOCKING_ENABLED, VITE_KEYCLOAK_URL: $VITE_KEYCLOAK_URL, VITE_KEYCLOAK_REALM: $VITE_KEYCLOAK_REALM, VITE_KEYCLOAK_CLIENT_ID: $VITE_KEYCLOAK_CLIENT_ID, VITE_BITCR_DEV_INCLUDE_CROWDIN_IN_CONTEXT_TOOLING: $VITE_BITCR_DEV_INCLUDE_CROWDIN_IN_CONTEXT_TOOLING}')

cat <<EOF > /usr/share/nginx/html/config.js
window.__ENV__ = ${JSON_ENV};
EOF
4 changes: 4 additions & 0 deletions docker/nginx/templates/default.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ server {
add_header Cache-Control "no-store";
}

location = /config.js {
add_header Cache-Control "no-store";
}

location ~* \.(?:json)$ {
expires 1d;
add_header Cache-Control "public";
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</head>
<body>
<div id="root"></div>
<script src="/config.js"></script>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
1 change: 1 addition & 0 deletions public/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
window.__ENV__ = window.__ENV__ || {}
10 changes: 6 additions & 4 deletions src/constants/meta.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { env } from "@/lib/env"

export default {
devModeEnabled: import.meta.env.DEV,
apiBaseUrl: import.meta.env.VITE_API_BASE_URL as string,
apiMocksEnabled: import.meta.env.VITE_API_MOCKING_ENABLED === "true",
crowdinInContextToolingEnabled: import.meta.env.VITE_BITCR_DEV_INCLUDE_CROWDIN_IN_CONTEXT_TOOLING === "true",
devModeEnabled: env.devModeEnabled,
apiBaseUrl: env.apiBaseUrl,
apiMocksEnabled: env.apiMocksEnabled,
crowdinInContextToolingEnabled: env.crowdinInContextToolingEnabled,
}
9 changes: 9 additions & 0 deletions src/generated/client/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ export type AnonPublicData = {
/**
* --------------------------- Quote info request
*/

export type MintingStatus = {
status: 'Disabled'
} | {
status: 'Enabled';
minted: number;
};

export type InfoReply = {
bill: BillInfo;
id: string;
Expand Down Expand Up @@ -160,6 +168,7 @@ export type InfoReply = {
keyset_id: string;
discounted: number;
status: 'Accepted';
minting_status: MintingStatus;
} | {
bill: BillInfo;
id: string;
Expand Down
7 changes: 4 additions & 3 deletions src/keycloak.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import Keycloak from "keycloak-js"
import { env } from "@/lib/env"

const keycloak = new Keycloak({
url: import.meta.env.VITE_KEYCLOAK_URL as string,
realm: import.meta.env.VITE_KEYCLOAK_REALM as string,
clientId: import.meta.env.VITE_KEYCLOAK_CLIENT_ID as string,
url: env.keycloakUrl,
realm: env.keycloakRealm,
clientId: env.keycloakClientId,
})

export const initKeycloak = async (): Promise<boolean> => {
Expand Down
Loading
Loading