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)
committerTomas Cohen Arazi <tomascohen@theke.io>
Wed, 7 Jun 2023 18:25:18 +0000 (15:25 -0300)
commit52b807544c6a0fa3944029fd4c94d4a21a7272b2
treec57ee19e54958883734aa5f5464c774b7878fbe4
parent894797e311862d28610b296704304b455d37e931
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>
Koha/Encryption.pm
about.pl