Improved Easy_domain, with boolean env vars
[hcoop/domtool2.git] / lib / easy_domain.dtl
CommitLineData
6bb366c5
AC
1{{The most common kinds of domain configuration}}
2
6eeb3bf9 3val default_node : (node) = "mire";
60695e99 4val web_node : (web_node) = "mire";
15e529d6
AC
5
6val webAt =
60695e99 7 \ n : (web_node) ->
15e529d6
AC
8 \ host : (host) ->
9 \\ config : Vhost ->
60695e99 10 (dns (dnsA host (ip_of_node (web_node_to_node n)));
15e529d6
AC
11
12 vhost host where
b5f2d506 13 WebPlaces = [web_place_default n]
15e529d6
AC
14 with
15 config
16 end);
17
18val web = webAt web_node;
6bb366c5 19
2e87719c
AC
20val 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
a356587a 33val addDefaultAlias = begin
d4e42f2a 34 mailbox <- Mailbox;
a356587a 35 defaultAlias mailbox
d4e42f2a
AC
36end;
37
38val addWww = begin
39 web "www" with
40 serverAliasDefault;
41 www : [Vhost] <- WWW;
42 www
43 end
44end;
45
a356587a 46val dom =
6bb366c5
AC
47 \ d : (your_domain) ->
48 \\ config : Domain ->
49 domain d with
94b7b11a
AC
50 dns (dnsNS "ns1.hcoop.net");
51 dns (dnsNS "ns3.hcoop.net");
6bb366c5 52
16465a9a 53 dns (dnsDefaultA (ip_of_node (web_node_to_node web_node)));
6eeb3bf9 54
6bb366c5 55 handleMail;
1c5aa57d 56 dns (dnsMX 1 "deleuze.hcoop.net");
6bb366c5 57
a356587a
AC
58 createWWW : bool <- CreateWWW;
59 if createWWW then
60 addWww
61 else
62 Skip
63 end;
d4e42f2a 64
a356587a
AC
65 defAl : bool <- DefaultAlias;
66 if defAl then
67 addDefaultAlias
68 else
69 Skip
70 end;
d4e42f2a 71
a356587a 72 config
6b718954
AC
73 end;
74
8c142ff5
AC
75val nameserver = \host -> dns (dnsNS host);
76val dnsIP = \from -> \to -> dns (dnsA from to);
77val dnsMail = \num -> \host -> dns (dnsMX num host);
78val dnsAlias = \from -> \to -> dns (dnsCNAME from to);
eda33894 79val dnsDefault = \to -> dns (dnsDefaultA to);