Skip to content

feat: Introduce runtime configuration for the frontend via config.js to allow dynamic updates without rebuilding the Docker image#159

Merged
hsluoyz merged 3 commits intoapache:masterfrom
pawelmarkowski:runtime-web-configuration
Feb 16, 2026
Merged

feat: Introduce runtime configuration for the frontend via config.js to allow dynamic updates without rebuilding the Docker image#159
hsluoyz merged 3 commits intoapache:masterfrom
pawelmarkowski:runtime-web-configuration

Conversation

@pawelmarkowski
Copy link
Contributor

@pawelmarkowski pawelmarkowski commented Feb 16, 2026

fix: #158

…` to allow dynamic updates without rebuilding the Docker image.
@CLAassistant
Copy link

CLAassistant commented Feb 16, 2026

CLA assistant check
All committers have signed the CLA.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for runtime (post-build) configuration of the React frontend by loading a config.js file at startup, enabling Docker users to override Casdoor connection settings without rebuilding the image (addresses #158).

Changes:

  • Load window.appConfig at runtime and use it as the frontend auth configuration (with defaults as fallback).
  • Ensure config.js is loaded before the React bundle via index.html.
  • Document how to mount/override config.js when running the Docker image.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
web/src/Conf.js Reads auth configuration from a runtime-injected global (window.appConfig) with fallback defaults.
web/public/index.html Loads config.js before the React app initializes.
web/public/config.js Provides a default runtime configuration file that can be replaced/mounted in Docker.
README.md Adds Docker instructions and an example config.custom.js for runtime configuration.
Comments suppressed due to low confidence (1)

web/src/Conf.js:24

  • AuthConfig uses window.appConfig || { ...defaults }, so if config.js exists but provides only a partial config (or an empty object), required fields like redirectPath/organizationName become undefined and get passed into casdoor-js-sdk. Prefer merging runtime config over defaults (e.g., defaults overlaid with window.appConfig) so missing keys still fall back safely.
export const AuthConfig = window.appConfig || {
  // Fallback defaults if config.js is not loaded
  serverUrl: "https://door.casdoor.com",
  clientId: "af6b5aa958822fb9dc33",
  appName: "app-casibase",
  organizationName: "casbin",
  redirectPath: "/callback",
};

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

hsluoyz and others added 2 commits February 16, 2026 16:15
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@hsluoyz hsluoyz changed the title feat: Introduce runtime configuration for the frontend via `config.js… feat: Introduce runtime configuration for the frontend via config.js to allow dynamic updates without rebuilding the Docker image Feb 16, 2026
@hsluoyz hsluoyz merged commit c47729a into apache:master Feb 16, 2026
4 checks passed
@github-actions
Copy link

🎉 This PR is included in version 1.71.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@pawelmarkowski pawelmarkowski deleted the runtime-web-configuration branch February 16, 2026 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] Runtime Configuration for UI

4 participants