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

remove es.url and use the components (es.protocol, es.host, es.port) instead #111

Open
wants to merge 1 commit into
base: 44-elasticsearch-config-env
Choose a base branch
from

Conversation

davidblasby
Copy link

I've noticed some inconsistencies in the es configuration.

By this I mean;

  1. If I set es.host (vi the EnvVars), then it doesn't really really get used. It will be replaced with es.url - which will be localhost (defined earlier).
    • the EsRestClient partially used es.url and partially es.* vars.
    • RestClientBuilder builder = RestClient.builder(new HttpHost(serverHost, Integer.parseInt(serverPort), serverProtocol));
    • this is using the defined es.port, es.host, etc.. NOT THE es.url
  2. the next line if (serverUrl.startsWith("https://")) -- this is using es.url INSTEAD of es.protocol

So, you must:

a. define all the es.* variables
b. have es.url consistent with the set variables.

This PR removes the es.url configuration and instead builds it directly from es.protocol, es.host, and es.port. Currently, es.url isn't really being used (EsRestClient uses the component not es.url). I've kept the serverUrl variable because its used in a few other places.

@davidblasby davidblasby requested a review from josegar74 February 5, 2025 21:24
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@davidblasby
Copy link
Author

@josegar74 -
Hi, jose, I reviewed your PR (es config with Environment vars).

I create some changes for it (this PR)

This is because es.url is problematic - its not consistent and has poor default values. Its also setting the same config values in two different ways. The code actually uses the individual components es.host - NOT the es.url. I've made that more consistent.

@@ -473,7 +473,7 @@
<servlet-class>org.fao.geonet.proxy.URITemplateProxyServlet</servlet-class>
<init-param>
<param-name>targetUri</param-name>
<param-value>${es.url}/${es.index.features}/{_}</param-value>
<param-value>${es.protocol}://${es.host}:${es.post}/${es.index.features}/{_}</param-value>
Copy link
Author

Choose a reason for hiding this comment

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

@josegar74 - please verify this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants