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 Feb 16, 2026
Conversation
…` to allow dynamic updates without rebuilding the Docker image.
There was a problem hiding this comment.
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.appConfigat runtime and use it as the frontend auth configuration (with defaults as fallback). - Ensure
config.jsis loaded before the React bundle viaindex.html. - Document how to mount/override
config.jswhen 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
AuthConfiguseswindow.appConfig || { ...defaults }, so ifconfig.jsexists but provides only a partial config (or an empty object), required fields likeredirectPath/organizationNamebecomeundefinedand get passed intocasdoor-js-sdk. Prefer merging runtime config over defaults (e.g., defaults overlaid withwindow.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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
config.js to allow dynamic updates without rebuilding the Docker image
|
🎉 This PR is included in version 1.71.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix: #158