Skip to content

Conversation

@rprouse
Copy link
Contributor

@rprouse rprouse commented Apr 10, 2025

I am using an authenticated version of Elasticsearch. This adds the ability to pass in ELASTICSEARCH_USER and ELASTICSEARCH_PASS. If they are not set, it falls back on the original non-authenticated Elasticsearch.

If you want to test, I have an image on DockerHub, rprouse/cpuad-updater:20250410

@satomic satomic requested a review from Copilot April 10, 2025 15:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

self.es = Elasticsearch(
Paras.elasticsearch_url
)
if Paras.elasticsearch_user is None or Paras.elasticsearch_pass is None:
Copy link

Copilot AI Apr 10, 2025

Choose a reason for hiding this comment

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

The current check treats the scenario where only one credential is provided as if authentication is not needed, which could lead to unexpected behavior. Consider adding a validation that requires both ELASTICSEARCH_USER and ELASTICSEARCH_PASS to be set, or raise an error if only one is provided.

Suggested change
if Paras.elasticsearch_user is None or Paras.elasticsearch_pass is None:
if (Paras.elasticsearch_user is None) != (Paras.elasticsearch_pass is None):
logger.error("Both ELASTICSEARCH_USER and ELASTICSEARCH_PASS must be set, or neither should be set.")
raise ValueError("Invalid Elasticsearch credentials configuration.")
if Paras.elasticsearch_user is None and Paras.elasticsearch_pass is None:

Copilot uses AI. Check for mistakes.
satomic/cpuad-updater
```
If your Elasticsearch instance requires authentication, pass include the `ELASTICSEARCH_USER` and `ELASTICSEARCH_PASS` environment variables.
Copy link

Copilot AI Apr 10, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider rephrasing the sentence for clarity, e.g., 'If your Elasticsearch instance requires authentication, include the ELASTICSEARCH_USER and ELASTICSEARCH_PASS environment variables.'

Suggested change
If your Elasticsearch instance requires authentication, pass include the `ELASTICSEARCH_USER` and `ELASTICSEARCH_PASS` environment variables.
If your Elasticsearch instance requires authentication, include the `ELASTICSEARCH_USER` and `ELASTICSEARCH_PASS` environment variables.

Copilot uses AI. Check for mistakes.
@satomic
Copy link
Owner

satomic commented Apr 10, 2025

reviewed, merged

@satomic satomic merged commit edd6b55 into satomic:main Apr 10, 2025
@rprouse
Copy link
Contributor Author

rprouse commented Apr 10, 2025

I pulled your latest docker image. Both of my issues are fixed. Thanks for your awesome work.

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.

2 participants