Catch-all aliases working again
[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 ->
10 (dns (dnsA 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
18 val web = webAt web_node;
19
20 val webAtIp =
21 \ ip : (your_ip) ->
22 \ host : (host) ->
23 \\ config : Vhost -> begin
24 dns (dnsA host (your_ip_to_ip ip));
25
26 vhost host where
27 WebPlaces = [web_place web_node ip]
28 with
29 config
30 end
31 end;
32
33 val catchAllAlias = \ mailbox -> aliasPrim catchAllSource (addressTarget mailbox);
34
35 val addCatchAllAlias = begin
36 mailbox <- Mailbox;
37 catchAllAlias 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 domNoWwwNoDefaultAlias =
49 \ d : (your_domain) ->
50 \\ config : Domain ->
51 domain d with
52 dns (dnsNS "ns1.hcoop.net");
53 dns (dnsNS "ns3.hcoop.net");
54
55 dns (dnsDefaultA (ip_of_node (web_node_to_node web_node)));
56
57 handleMail;
58 dns (dnsMX 1 "deleuze.hcoop.net");
59
60 config
61 end;
62
63 val domNoDefaultAlias =
64 \ d : (your_domain) ->
65 \\ config : Domain ->
66 domNoWwwNoDefaultAlias d with
67 addWww;
68 config
69 end;
70
71 val domNoWww =
72 \ d : (your_domain) ->
73 \\ config : Domain ->
74 domNoWwwNoDefaultAlias d with
75 config;
76 addCatchAllAlias;
77 end;
78
79 val dom =
80 \ d : (your_domain) ->
81 \\ config : Domain ->
82 domNoDefaultAlias d with
83 config;
84 addCatchAllAlias;
85 end;
86
87 val nameserver = \host -> dns (dnsNS host);
88 val dnsIP = \from -> \to -> dns (dnsA from to);
89 val dnsMail = \num -> \host -> dns (dnsMX num host);
90 val dnsAlias = \from -> \to -> dns (dnsCNAME from to);
91 val dnsDefault = \to -> dns (dnsDefaultA to);