fix frontendproperties readFile() to work with classpath and update download_custom_buttons_json reference #10946
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.
This fixes the readFile() method which is used by frontendproperties (application.properties) to read the contents of a file in, to work with the "classpath:" syntax. This PR also updates the reference config for download_custom_buttons_json to the classpath syntax so it works.
Properties affected:
Explanation
The existing documentation for these properties mentioned that "classpath:" syntax could be used. E.g. from the application.properties.EXAMPLE, I don't believe this would work:
However, the readFile() method didn't support that syntax. It would only work with the file system. Furthermore, production instances (at least the public cBioPortal) build the server to a single "app.jar" file (using the "web" docker config). If the above file exists in the "web-and-data" loose configuration via the repo, but no longer exists as a loose file in the "web" configuration, then you have configuration that works in dev but fails in production.
That means that these properties only worked if they had an absolute path reference to a file, and the file is manually placed on the file system of the server (and not packed into the app.jar). E.g.
Checks
[DONE] I have tested the docker "web-and-data" container with loose files. All 3 of these variants work successfully in that scenario:
[TODO] This needs to be tested in the "web" container with just the app.jar. The "classpath" syntax should work, since this pattern is used in other places, but I have been unable to test this image to confirm. I get an error
[TODO] This needs to be regressed to make sure that existing instances that use these properties and are referencing loose files this way still work in the "web" container with just app.jar. For example, if there is an instance that uses something like this:
This should work based on the above tests with the "web-and-data" container, but to be safe, it should be tested with the "web" container.
Reviewers
@alisman