Bug 36134: Read complete Elasticsearch configuration in about.pl

When enabling Elasticsearch authentication in Koha using userinfo
parameter of Search::Elasticsearch, about.pl breaks and gives an
internal server error.

This patch reads the complete Elasticsearch configuration for
about.pl including userinfo causing about.pl to recover.

To test:
1. In Elasticsearch 7 settings, set "xpack.security.enabled: true"
2. Add <userinfo>elastic:password</userinfo> to KOHA_CONF elasticsearch
   settings
3. Restart plack and navigate to about.pl
4. Observe internal server error
5. Apply patch
6. Refresh about.pl
7. Observe it working again

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5511482951)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit e70bc2d20f)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Lari Taskula 2024-02-20 01:47:53 +00:00 committed by Lucas Gass
parent fd48bd79f3
commit a0f3d2a772

View file

@ -388,7 +388,7 @@ if ( C4::Context->preference('SearchEngine') eq 'Elasticsearch' ) {
# TODO: When new indexes get added, we could have other ways to
# fetch the list of available indexes (e.g. plugins, etc)
$es_status->{nodes} = $es_conf->{nodes};
my $es = Search::Elasticsearch->new({ nodes => $es_conf->{nodes} });
my $es = Search::Elasticsearch->new( $es_conf );
my $es_status->{version} = $es->info->{version}->{number};
foreach my $index ( @indexes ) {