mirror of
https://git.proxmox.com/git/proxmox-acme
synced 2025-04-28 17:47:09 +00:00
dns: cope with plugin json index not being available
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>
This commit is contained in:
parent
7b8275a30d
commit
e2483043c6
@ -23,13 +23,19 @@ sub type {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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));
|
|
||||||
|
|
||||||
|
my $plugin_cache;
|
||||||
sub get_supported_plugins {
|
sub get_supported_plugins {
|
||||||
return $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;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub properties {
|
sub properties {
|
||||||
|
my $plugins = get_supported_plugins();
|
||||||
return {
|
return {
|
||||||
api => {
|
api => {
|
||||||
description => "API plugin name",
|
description => "API plugin name",
|
||||||
|
Loading…
Reference in New Issue
Block a user