]> git.proxmox.com Git - pmg-docs.git/blob - gen-pmg.conf.5-opts.pl
installation: fix codeblock rendering in zfs performance tips section
[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 $skiped_keys = {
18 'delete' => 1,
19 digest => 1,
20 };
21
22 my $key_groups = {
23 'mail-options' => [
24 'mail' , {
25 maxsize => 1,
26 rejectunknown => 1,
27 rejectunknownsender => 1,
28 helotests => 1,
29 dnsbl_sites => 1,
30 dnsbl_threshold => 1,
31 verifyreceivers => 1,
32 greylist => 1,
33 spf => 1,
34 hide_received => 1,
35 dwarning => 1,
36 conn_count_limit => 1,
37 conn_rate_limit => 1,
38 message_rate_limit => 1,
39 banner => 1,
40 }],
41 'mail-tls' => [
42 'mail' , {
43 tls => 1,
44 tlsheader => 1,
45 tlslog => 1,
46 }],
47 'mail-ports' => [
48 'mail' , {
49 int_port => 1,
50 ext_port => 1,
51 }],
52 'mail-relaying' => [
53 'mail' , {
54 relay => 1,
55 relaynomx => 1,
56 relayport => 1,
57 smarthost => 1,
58 smarthostport => 1,
59 }],
60 };
61
62 if (1) {
63 # verify if we document all mail settings
64 my $plugin = PMG::Config::Base->lookup('mail');
65 my $schema = $plugin->updateSchema(1);
66 my $properties = $schema->{properties};
67
68 my $found_mail_keys = {};
69 foreach my $group (keys %$key_groups) {
70 my ($sec, $hash) = @{$key_groups->{$group}};
71 next if $sec ne 'mail';
72 foreach my $k (keys %$hash) {
73 die "unknown key '$k'" if !defined($properties->{$k});
74 $found_mail_keys->{$k} = 1;
75 }
76 }
77 foreach my $k (keys %$properties) {
78 next if $skiped_keys->{$k};
79 next if $k =~ m/^max_(filters|policy|smtpd_in|smtpd_out)$/;
80 die "undocumented key '$k'" if !defined($found_mail_keys->{$k});
81 }
82 }
83
84
85 my $select_keys;
86
87 if ($single_section) {
88 if (my $a = $key_groups->{$single_section}) {
89 my ($sec, $hash) = @$a;
90 $single_section = $sec;
91 $select_keys = $hash;
92 }
93 }
94
95
96 foreach my $section (@$types) {
97 my $plugin = PMG::Config::Base->lookup($section);
98 my $schema = $plugin->updateSchema(1);
99 my $properties = $schema->{properties};
100
101 if (defined($single_section)) {
102 next if $section ne $single_section;
103 } else {
104 print ".Section '$section'\n\n";
105 }
106
107 $found = 1;
108
109 my $filter = sub {
110 my ($key, $phash) = @_;
111 return 1 if $skiped_keys->{$key};
112 return 1 if $select_keys && !$select_keys->{$key};
113 return 0;
114 };
115
116 print PVE::RESTHandler::dump_properties(
117 $properties, 'asciidoc', 'config', $filter);
118 }
119
120 if (defined($single_section)) {
121 die "no such section '$single_section'" if !$found;
122 }
123
124 exit(0);