Skip to content
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

353/feature/config resolve #399

Merged
merged 5 commits into from
Aug 10, 2023
Merged

353/feature/config resolve #399

merged 5 commits into from
Aug 10, 2023

Conversation

tokee
Copy link
Contributor

@tokee tokee commented Aug 9, 2023

Adds more flexible resolving of the config files. The use case is for the SolrWayback bundle, where the config files can now be placed directly in the bundle folder. It it also be possible to place the config files in the root of the project folder with the source code, when running under jetty.

If the location of the two property files are not specified in the WAR context, they are sought resolved from the container (e.g. tomcat or jetty) root. If not there, the parent folder is checked and so forth. If that does not yield results, the current folder as well as the user's home folder is checked in a similar manner.

Testing this properly is cumbersome as it requires at least

  • Placing a config file in the root of the project folder and running with jetty
  • Placing a config file in the root a tomcat folder where the WAR is deployed
  • Specifying a config file location in the context (i.e. solrwayback.xml) for SolrWayback using tomcat and checking that this is used instead of another config placed directly in the tomcat folder. See the webapp/META-INF/context.xml for how to specify the location explicitly

This closes #353

@tokee tokee requested a review from VictorHarbo August 9, 2023 14:44
@tokee tokee self-assigned this Aug 9, 2023
Copy link
Collaborator

@VictorHarbo VictorHarbo left a comment

Choose a reason for hiding this comment

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

I've tested all three config placements and found one issue.
I can't seem to get the context.xml configuration working. When I add a path to get config from it does not update when i restart the tomcat. If i then redeploy the webapp, the contenxt.xml gets overwritten.

* <li>As {@code env:user.dir/resource}, {@code env:user.dir/../resource} etc</li>
* <li>As {@code env:user.home/resource}</li>
* </ul>
* When running under Tomcat, {@code catalina.home} is guaranteed to be set and {@code catalina.home} might be set.
Copy link
Collaborator

Choose a reason for hiding this comment

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

You are referencing catalina.home twice here. One of them should be catalina.base

* <li>As {@code env:user.dir/resource}, {@code env:user.dir/../resource} etc</li>
* <li>As {@code env:user.home/resource}</li>
* </ul>
* When running under Tomcat, {@code catalina.home} is guaranteed to be set and {@code catalina.home} might be set.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Again, home twice, no base

Copy link
Collaborator

@VictorHarbo VictorHarbo left a comment

Choose a reason for hiding this comment

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

LGTM!

@VictorHarbo VictorHarbo merged commit 8ad12fa into master Aug 10, 2023
2 checks passed
@VictorHarbo VictorHarbo deleted the 353/feature/config_resolve branch August 10, 2023 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better resolving of configurations
2 participants