]> git.proxmox.com Git - pmg-docs.git/blob - gen-pmg.conf.5-opts.pl
fd928cea632848c2aeded12d037a0d90856421d2
[pmg-docs.git] / gen-pmg.conf.5-opts.pl
1 #!/usr/bin/perl
2
3 use lib '.';
4 use strict;
5 use warnings;
6 use PVE::RESTHandler;
7
8 use Data::Dumper;
9
10 use PMG::Config;
11
12 my $types = PMG::Config::Base->lookup_types;
13
14 my $single_section = shift;
15 my $found = 0;
16
17 my $key_groups = {
18 'mail-relaying' => [
19 'mail' , {
20 relay => 1,
21 relaynomx => 1,
22 relayport => 1,
23 smarthost => 1,
24 }],
25 };
26
27 my $select_keys;
28
29 if ($single_section) {
30 if (my $a = $key_groups->{$single_section}) {
31 my ($sec, $hash) = @$a;
32 $single_section = $sec;
33 $select_keys = $hash;
34 }
35 }
36
37
38 foreach my $section (@$types) {
39 my $plugin = PMG::Config::Base->lookup($section);
40 my $schema = $plugin->updateSchema(1);
41 my $properties = $schema->{properties};
42
43 if (defined($single_section)) {
44 next if $section ne $single_section;
45 } else {
46 print ".Section '$section'\n\n";
47 }
48
49 $found = 1;
50
51 my $filter = sub {
52 my ($key, $phash) = @_;
53 return 1 if $key eq 'digest';
54 return 1 if $key eq 'delete';
55 return 1 if $select_keys && !$select_keys->{$key};
56 return 0;
57 };
58
59 print PVE::RESTHandler::dump_properties(
60 $properties, 'asciidoc', 'config', $filter);
61 }
62
63 if (defined($single_section)) {
64 die "no such section '$single_section'" if !$found;
65 }
66
67 exit(0);