Add dnsWildcardIP
[hcoop/domtool2.git] / lib / easy_domain.dtl
1 {{The most common kinds of domain configuration}}
2
3 val default_node : (node) = "mire";
4 val web_node : (web_node) = "mire";
5 val web_ip = ip_of_node (web_node_to_node web_node);
6
7 val webAt =
8 \ n : (web_node) ->
9 \ host : (host) ->
10 \\ config : Vhost -> begin
11 dns (dnsA (literal host) (ip_of_node (web_node_to_node n)));
12
13 vhost host where
14 WebPlaces = [web_place_default n]
15 with
16 config
17 end
18 end;
19
20 val web = webAt web_node;
21
22 val webAtIp =
23 \ ip : (your_ip) ->
24 \ host : (host) ->
25 \\ config : Vhost -> begin
26 dns (dnsA (literal host) (your_ip_to_ip ip));
27
28 vhost host where
29 WebPlaces = [web_place web_node ip]
30 with
31 config
32 end
33 end;
34
35 val addDefaultAlias = begin
36 mailbox <- Mailbox;
37 defaultAlias mailbox
38 end;
39
40 val addWww = begin
41 web "www" with
42 serverAliasDefault;
43 www : [Vhost] <- WWW;
44 www
45 end
46 end;
47
48 val dom =
49 \ d : (your_domain) ->
50 \\ config : Domain ->
51 domain d with
52 dns (dnsNS "ns1.hcoop.net");
53 dns (dnsNS "ns3.hcoop.net");
54 dns (dnsNS "ns5.hcoop.net");
55
56 dns (dnsA default (ip_of_node (web_node_to_node web_node)));
57
58 hmail : bool <- HandleMail;
59 if hmail then
60 handleMail
61 else
62 Skip
63 end;
64
65 amx : bool <- AddMX;
66 if amx then
67 dns (dnsMX 1 "deleuze.hcoop.net")
68 else
69 Skip
70 end;
71
72 createWWW : bool <- CreateWWW;
73 if createWWW then
74 addWww
75 else
76 Skip
77 end;
78
79 defAl : bool <- DefaultAlias;
80 if defAl then
81 addDefaultAlias
82 else
83 Skip
84 end;
85
86 config
87 end;
88
89 val nameserver = \host -> dns (dnsNS host);
90 val dnsIP = \from -> \to -> dns (dnsA (literal from) to);
91 val dnsIPv6 = \from -> \to -> dns (dnsAAAA (literal from) to);
92 val dnsMail = \num -> \host -> dns (dnsMX num host);
93 val dnsAlias = \from -> \to -> dns (dnsCNAME (literal from) to);
94 val dnsDefault = \to -> dns (dnsA default to);
95 val dnsDefaultv6 = \to -> dns (dnsAAAA default to);
96 val dnsText = \from -> \to -> dns (dnsTXT (srv_literal from) to);
97 val dnsDefaultText = \to -> dns (dnsTXT srv_default to);
98
99 val dnsWildcardIP = \to -> dns (dnsA wildcard to);