Fix ES client for nil password
What does this MR do and why?
This MR fixes the elasticsearch_config
method to address https://gitlab.com/gitlab-org/gitlab/-/issues/368703. Currently if we only set username
, password will be set to nil
and break the elasticsearch client.
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
How to set up and validate locally
- Enable Advanced Search
- Set the username with empty password
ApplicationSetting.current.update(elasticsearch_username: 'test', elasticsearch_password: '')
- Build Elasticsearch client using
elasticsearch_config
::Elasticsearch::Client.new(ApplicationSetting.current.elasticsearch_config)
- It shouldn't raise an exception
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #368703
Edited by Dmitry Gruzd