Skip to content

fix: frontend configuration externalisation - #2243

Merged
bosbaber merged 3 commits into
v1from
stephan/int-622
Sep 17, 2026
Merged

bosbaber merged 3 commits into
v1from
stephan/int-622

Conversation

@bosbaber

Copy link
Copy Markdown
Contributor

Context

At the moment the way wallet Next.js frontend works is that it bakes every NEXT_PUBLIC_* value into the bundle during build time. The net effect is that if I want to change the URL where the wallet is being served from, then I need to modify the build pipelines and rebuild the whole applications.

This is very limiting and prevents a cluster administrator from making certain changes without involving the development process.

Changes

This pull request refactors how the wallet frontend is configured and deployed, making the image environment-agnostic and simplifying configuration management. All environment variables required by the frontend are now read at runtime from the container environment instead of being baked into the image at build time. This allows a single image to be used across all deployments, with configuration changes requiring only a pod restart rather than a rebuild. The changes also remove the use of NEXT_PUBLIC_ prefixes, update documentation and sample configs, and add tests to ensure the new behavior.

@bosbaber
bosbaber requested a lite review from Copilot September 16, 2026 17:38
@bosbaber bosbaber self-assigned this Sep 16, 2026
@github-actions github-actions Bot added type: documentation Improvements or additions to documentation package: wallet/frontend Wallet frontend implementations type: ci Changes to CI workflows type: source Source changes labels Sep 16, 2026
@bosbaber
bosbaber marked this pull request as draft September 16, 2026 17:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

It changes the wallet frontend’s runtime configuration and deployment contract across Next.js SSR, Docker, Helm, and release publishing, so it needs careful human validation to avoid breaking existing deployments.

Pull request overview

This PR makes the wallet Next.js frontend image environment-agnostic by moving configuration (URLs/theme/feature flags) from build-time NEXT_PUBLIC_* inlining to runtime container environment reads, with Helm values/docs updated accordingly to support “change config + restart pod” deployments.

Changes:

  • Introduces a runtime-config mechanism (runtimeConfig.ts + _document.tsx injection) and updates frontend pages/utilities to use it instead of process.env.NEXT_PUBLIC_*.
  • Updates networking/runtime behavior (Socket.IO connection handling, server vs browser backend URL selection) and adds a production start.js entrypoint to validate required env vars before serving.
  • Refactors Dockerfiles, Helm chart values/docs, and the release workflow to remove build-time frontend config.
File summaries
File Description
packages/wallet/frontend/src/utils/constants.ts Switch constants to read from injected runtime config (no NEXT_PUBLIC_*).
packages/wallet/frontend/src/pages/no-access.tsx Build auth redirect link from runtime AUTH_HOST.
packages/wallet/frontend/src/pages/kyc.tsx Use runtime BACKEND_URL for browser-facing backend URLs.
packages/wallet/frontend/src/pages/grant-interactions/index.tsx Use runtime AUTH_HOST for interaction redirects.
packages/wallet/frontend/src/pages/_document.tsx Inject runtime config into HTML via inline script; apply runtime theme.
packages/wallet/frontend/src/pages/_app.tsx Use connectToBackend() and force SSR via getInitialProps.
packages/wallet/frontend/src/lib/socket.ts New helper to correctly derive Socket.IO origin/path from BACKEND_URL.
packages/wallet/frontend/src/lib/runtimeConfig.ts New runtime config contract: env read on server + injected window config in browser.
packages/wallet/frontend/src/lib/httpClient.ts Use server-internal backend URL for SSR and injected runtime backend URL in browser.
packages/wallet/frontend/scripts/start.js New production entrypoint to fail fast on missing runtime config.
packages/wallet/frontend/next.config.js Remove build-time env/publicRuntimeConfig usage to avoid freezing config into standalone build.
packages/wallet/frontend/Dockerfile.prod Remove build args/env baking; run start.js before server.js.
packages/wallet/frontend/Dockerfile.dev Remove build-time NEXT_PUBLIC_* args; rely on runtime env.
packages/wallet/frontend/.env.local Update local example to non-NEXT_PUBLIC_* runtime env vars.
packages/wallet/frontend/.env.example Update documentation/comments to reflect runtime-config model and new env var names.
helm/testnet-wallet/values.yaml Add backendInternal and rename frontend ConfigMap keys away from NEXT_PUBLIC_*.
helm/testnet-wallet/tests/configMap.frontend_test.yaml Add Helm unittest coverage for emitted runtime config keys and absence of NEXT_PUBLIC_*.
helm/testnet-wallet/README.md Update chart docs to describe runtime-config keys and behavior.
.github/workflows/release.yml Remove wallet-frontend build-time config inputs; document runtime-config behavior.
Review details
  • Files reviewed: 19/19 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/wallet/frontend/scripts/start.js Outdated
Comment thread .github/workflows/release.yml Outdated
Comment thread helm/testnet-wallet/README.md Outdated
Comment thread helm/testnet-wallet/values.yaml Outdated
@bosbaber
bosbaber marked this pull request as ready for review September 16, 2026 17:54
@bosbaber
bosbaber merged commit 8847680 into v1 Sep 17, 2026
16 checks passed
@bosbaber
bosbaber deleted the stephan/int-622 branch September 17, 2026 07:21
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.0.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: wallet/frontend Wallet frontend implementations released on @v1 type: ci Changes to CI workflows type: documentation Improvements or additions to documentation type: source Source changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants