-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent Configuration Fetching for SciCat Frontend #1728
Comments
This has been done in this way on purpose: For a production deployment everything is served on one hostname, The FE-local version is only suitable for dev setups without a proxy included, as there is no way to find where the backend should be. Maybe we should skip this option and just require dev setups with proxy. |
Thank you for your clarification! I can see the intent behind the current design, but I believe rethinking deployment strategies can provide a more modular and maintainable solution.
From this I take you actually need multiple customized FEs. Because this implies that different BE provide different FE config... This will be achieved much better with localized configs, especially if we talk K8s i.e. ConfigMaps. So there will be one BE deployment and multiple FE. This will also reduce coupling between two.
Not necessarily, I have dev setup with proxy and still there is no benefit in keeping FE config on the BE. In fact I completely got rid off it, by removing corresponding code lines. |
A while back, the community discussed the issue and decided to serve the FE config from a BE endpoint. That said, I see your point to decouple FE and BE and, I agree with you, that the code can improve. I propose the following solution which should allow all use cases:
Thoughts? Also would you like to work on such feature? |
H-hm, an interesting case, indeed. How will you force the clients to fetch the new configuration once it's changed? What if the configuration scheme has to be updated with some incompatible changes? |
Issue Name
Inconsistent Configuration Fetching for SciCat Frontend
Summary
Currently, there is an inconsistency in how the SciCat frontend fetches its configuration. The frontend supports fetching configuration both locally (from a static file) and remotely (from the backend), leading to unnecessary complexity and potential confusion.
Steps to Reproduce
/backend/api/v3/admin/config
.If the backend configuration is unavailable, it falls back to fetching local configuration from
/scicat/assets/config.json
.Current Behaviour
The frontend uses a nested try-catch structure to manage configuration fetching, which is an anti-pattern for flow control.
This approach introduces confusion and tightly couples frontend behavior to backend configuration, violating separation of concerns.
Expected Behaviour
The backend should not be responsible for providing frontend configurations.
The frontend configuration should be purely local to the frontend to avoid unnecessary dependencies.
Error handling should avoid the use of
try-catch
for flow control and instead use a cleaner and more modular approach.Extra Details
Refactor the configuration fetching logic to remove the backend dependency for frontend configuration.
Ensure error handling is clean and adheres to best practices.
If remote configuration is unavoidable, establish a clear distinction between backend and frontend configuration responsibilities.
The text was updated successfully, but these errors were encountered: