-
Notifications
You must be signed in to change notification settings - Fork 29
Add Elasticsearch authentication #19
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
Conversation
There was a problem hiding this 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: |
Copilot
AI
Apr 10, 2025
There was a problem hiding this comment.
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.
| 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: |
| satomic/cpuad-updater | ||
| ``` | ||
| If your Elasticsearch instance requires authentication, pass include the `ELASTICSEARCH_USER` and `ELASTICSEARCH_PASS` environment variables. |
Copilot
AI
Apr 10, 2025
There was a problem hiding this comment.
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.'
| 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. |
|
reviewed, merged |
|
I pulled your latest docker image. Both of my issues are fixed. Thanks for your awesome work. |
I am using an authenticated version of Elasticsearch. This adds the ability to pass in
ELASTICSEARCH_USERandELASTICSEARCH_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