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