-
-
Notifications
You must be signed in to change notification settings - Fork 338
fix(Elasticsearch): Use HTTP wait strategy #1593
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
Changes from 4 commits
20d3bd3
d798b07
69a8d47
dafdf65
c1e02f5
bd15f24
86148f7
04e32d5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,4 +68,27 @@ public ElasticsearchConfiguration(ElasticsearchConfiguration oldValue, Elasticse | |
| /// Gets the Elasticsearch password. | ||
| /// </summary> | ||
| public string Password { get; } | ||
|
|
||
| /// <summary> | ||
| /// Checks if https connection to container is supported, based on configuration environment variables. | ||
| /// </summary> | ||
| public bool HttpsEnabled | ||
| { | ||
| get | ||
| { | ||
| var hasSecurityEnabled = Environments | ||
| .TryGetValue("xpack.security.enabled", out var securityEnabled); | ||
|
|
||
| var hasHttpSslEnabled = Environments | ||
| .TryGetValue("xpack.security.http.ssl.enabled", out var httpSslEnabled); | ||
|
Comment on lines
+79
to
+83
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to not work for 7.x.x images, which don't have security enabled by default. So even though neither of the
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please test and set the environment variables explicitly to _ = new ElasticsearchBuilder()
.WithEnvironment("xpack.security.enabled", "false")
.WithEnvironment("xpack.security.http.ssl.enabled", "false")
.Build();I believe the expression is incorrect when SSL is not enabled by default. For version 8, you need to disable it explicitly. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that's a workaround I ended up with. If variables are there and are set to Perhaps you need to also check the tag and apply different logic for versions less than 8, where HTTPS is not enabled by default. Or maybe there is some better option. And possibly handle that specific exception and rethrow it with a clear message indicating protocol mismatch instead of swallowing it. |
||
|
|
||
| var httpsDisabled = | ||
| hasSecurityEnabled && | ||
| hasHttpSslEnabled && | ||
| "false".Equals(securityEnabled, StringComparison.OrdinalIgnoreCase) && | ||
| "false".Equals(httpSslEnabled, StringComparison.OrdinalIgnoreCase); | ||
|
|
||
| return !httpsDisabled; | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.