Bug 33934: Add more detail to 'No encryption_key in koha-conf.xml'
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 7 Jun 2023 07:30:15 +0000 (09:30 +0200)
committerMatt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Mon, 12 Jun 2023 11:53:36 +0000 (11:53 +0000)
commit748611f2f6404a097c73dd181b158ac41c18a70d
tree2b71c8677e21cda7dadce00126840edc9ddd43d9
parent63714f9b04fb8cb7e0b849c2653e1371f76070dd
Bug 33934: Add more detail to 'No encryption_key in koha-conf.xml'

If encryption_key is not set in $KOHA_CONF we are raising an exception.

This key was only needed for a couple of feature, but now we are using Koha::Encryption from the update DB process, and so the upgrade fails with no more info than 'No encryption_key in koha-conf.xml'.

We need to provide more detail in this error.

Additionally we reject "__ENCRYPTION_KEY__", in case people will simple
copy/paste that

Test plan:
Apply the patch
Edit $KOHA_CONf, remove the encryption_key entry (or blank)
restart_all
Go to the about page and enable 2FA
=> warning on the about page, and 500 server-side are displaying more
info about how to generate the missing entry
Edit $KOHA_CONF and set the value to __ENCRYPTION_KEY__
restart_all
=> Same messages
Edit $KOHA_CONF and set a correct value
restart_all
=> No error, everything is working correctly

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit d7288411f00e3afd2a0284193ce7742545d88266)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Koha/Encryption.pm
about.pl