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