]> git.proxmox.com Git - pmg-docs.git/blob - gen-pmg.conf.5-opts.pl
4f06ed70a3ded52cc1b85a2113e4ac70acf055e8
[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-options' => [
19 'mail' , {
20 maxsize => 1,
21 rejectunknown => 1,
22 rejectunknownsender => 1,
23 helotests => 1,
24 dnsbl_sites => 1,
25 verifyreceivers => 1,
26 greylist => 1,
27 spf => 1,
28 hide_received => 1,
29 dwarning => 1,
30 conn_count_limit => 1,
31 conn_rate_limit => 1,
32 message_rate_limit => 1,
33 banner => 1,
34 }],
35 'mail-ports' => [
36 'mail' , {
37 int_port => 1,
38 ext_port => 1,
39 }],
40 'mail-relaying' => [
41 'mail' , {
42 relay => 1,
43 relaynomx => 1,
44 relayport => 1,
45 smarthost => 1,
46 }],
47 };
48
49 my $select_keys;
50
51 if ($single_section) {
52 if (my $a = $key_groups->{$single_section}) {
53 my ($sec, $hash) = @$a;
54 $single_section = $sec;
55 $select_keys = $hash;
56 }
57 }
58
59
60 foreach my $section (@$types) {
61 my $plugin = PMG::Config::Base->lookup($section);
62 my $schema = $plugin->updateSchema(1);
63 my $properties = $schema->{properties};
64
65 if (defined($single_section)) {
66 next if $section ne $single_section;
67 } else {
68 print ".Section '$section'\n\n";
69 }
70
71 $found = 1;
72
73 my $filter = sub {
74 my ($key, $phash) = @_;
75 return 1 if $key eq 'digest';
76 return 1 if $key eq 'delete';
77 return 1 if $select_keys && !$select_keys->{$key};
78 return 0;
79 };
80
81 print PVE::RESTHandler::dump_properties(
82 $properties, 'asciidoc', 'config', $filter);
83 }
84
85 if (defined($single_section)) {
86 die "no such section '$single_section'" if !$found;
87 }
88
89 exit(0);