Inject runtime URLs in the back-end served index.html - #64
Merged
Conversation
Contributor
Author
|
Deployed on |
MartinaeyNL
reviewed
Mar 26, 2026
MartinaeyNL
left a comment
Member
There was a problem hiding this comment.
Yeah this PR is fine with me.
I've only got two minor comments to simplify the scope to window, instead of global variables.
I'm not sure whether we should also follow a similar practice for the OpenRemote repository,
but this pattern is perfectly fine within a specific project like this.
| import './components/alert-message'; | ||
|
|
||
| const DEFAULT_MANAGER_CONFIG: ManagerConfig = { | ||
| managerUrl: ML_OR_URL || '/', |
Member
There was a problem hiding this comment.
I assume you removed this fallback to allow ML_OR_URL to be an empty value.
I think if you replace || with ??, it should still work, because it's a better null check.
managerUrl: MR_OR_URL ?? '/'
Contributor
Author
There was a problem hiding this comment.
Uses nullish coalesce now, thanks! I keep forgetting it exists haha.
…ty values/fallbacks
MartinaeyNL
approved these changes
Mar 26, 2026
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.
Closes #65
Currently the front-end bundle contains relative URLs that are embedded during its built process. This bundle is then served by the back-end service.
This change allows the back-end to dynamically inject the configured server URL environment variables into the served
index.htmlwhich is then used by the front-end as runtime config. This is more flexible and reliable than relying on embedded relative URLs. It only injects the necessary variables and does not expose anything else.The change also resolves an issue where the WS subscription would fail since the
ManagerConfigexpects the managerUrl to be absolute (e.g. containing the full address), to determine whether it should use WS or WSS.