[pve-devel] [Patch V3 manager 4/8] Add function that selects the desired plugin.

Wolfgang Link w.link at proxmox.com
Thu Apr 16 07:18:26 CEST 2020


These functions also extract the data required for the plugin.

Signed-off-by: Wolfgang Link <w.link at proxmox.com>
---
 PVE/API2/ACME.pm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/PVE/API2/ACME.pm b/PVE/API2/ACME.pm
index e69a563b..7bb3ab95 100644
--- a/PVE/API2/ACME.pm
+++ b/PVE/API2/ACME.pm
@@ -45,6 +45,33 @@ __PACKAGE__->register_method ({
 	];
     }});
 
+my $get_plugin_type = sub {
+    my ($domain, $acme_node_config) = @_;
+
+    my $plugin;
+    my $alias;
+    foreach my $index (keys %$acme_node_config) {
+	next if $index eq 'domains';
+
+	my $domain_config = $acme_node_config->{$index};
+	if (defined($domain_config->{domain}) &&
+	    $domain_config->{domain} eq $domain) {
+	    $plugin = $domain_config->{plugin};
+	    $alias = $domain_config->{alias};
+	    last;
+	}
+    }
+    return "standalone" if !defined($plugin);
+
+    my $plugin_conf = PVE::API2::ACMEPlugin::load_config();
+    my $data = $plugin_conf->{ids}->{$plugin};
+    my $plugin_type = $data->{type};
+
+    $data->{alias} = $alias;
+
+    return ($plugin_type, $data);
+};
+
 my $order_certificate = sub {
     my ($acme, $domains) = @_;
     print "Placing ACME order\n";
-- 
2.20.1





More information about the pve-devel mailing list