not nice to die plainly on a using this module (which can come in
indirectly/transitively), so lets better cope with that.
Nice side-effect, if nothing uses it, it won't get loaded, so less
IO and memory in that case.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
}
my $DNS_API_CHALLENGE_SCHEMA_FN = '/usr/share/proxmox-acme/dns-challenge-schema.json';
}
my $DNS_API_CHALLENGE_SCHEMA_FN = '/usr/share/proxmox-acme/dns-challenge-schema.json';
-my $plugins = from_json(PVE::Tools::file_get_contents($DNS_API_CHALLENGE_SCHEMA_FN));
sub get_supported_plugins {
sub get_supported_plugins {
+ if (!$plugin_cache) {
+ $plugin_cache = -e $DNS_API_CHALLENGE_SCHEMA_FN # we allow this to be optional as not all users require
+ ? from_json(PVE::Tools::file_get_contents($DNS_API_CHALLENGE_SCHEMA_FN))
+ : {};
+ }
+ return $plugin_cache;
+ my $plugins = get_supported_plugins();
return {
api => {
description => "API plugin name",
return {
api => {
description => "API plugin name",