Add dnsWildcardIP
[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";
539abe03 5val web_ip = ip_of_node (web_node_to_node web_node);
15e529d6
AC
6
7val webAt =
ae272cb5
AC
8 \ n : (web_node) ->
9 \ host : (host) ->
10 \\ config : Vhost -> begin
cfedb922 11 dns (dnsA (literal host) (ip_of_node (web_node_to_node n)));
15e529d6 12
ae272cb5
AC
13 vhost host where
14 WebPlaces = [web_place_default n]
15 with
16 config
17 end
18 end;
15e529d6
AC
19
20val web = webAt web_node;
6bb366c5 21
2e87719c 22val webAtIp =
ae272cb5
AC
23 \ ip : (your_ip) ->
24 \ host : (host) ->
25 \\ config : Vhost -> begin
cfedb922 26 dns (dnsA (literal host) (your_ip_to_ip ip));
2e87719c 27
ae272cb5
AC
28 vhost host where
29 WebPlaces = [web_place web_node ip]
30 with
31 config
32 end
33 end;
2e87719c 34
a356587a 35val addDefaultAlias = begin
d4e42f2a 36 mailbox <- Mailbox;
a356587a 37 defaultAlias mailbox
d4e42f2a
AC
38end;
39
40val addWww = begin
41 web "www" with
42 serverAliasDefault;
43 www : [Vhost] <- WWW;
44 www
45 end
46end;
47
a356587a 48val dom =
ae272cb5
AC
49 \ d : (your_domain) ->
50 \\ config : Domain ->
51 domain d with
52 dns (dnsNS "ns1.hcoop.net");
53 dns (dnsNS "ns3.hcoop.net");
58f385c6 54 dns (dnsNS "ns5.hcoop.net");
6bb366c5 55
cfedb922 56 dns (dnsA default (ip_of_node (web_node_to_node web_node)));
6eeb3bf9 57
b3cab94c
AC
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;
6bb366c5 71
ae272cb5
AC
72 createWWW : bool <- CreateWWW;
73 if createWWW then
74 addWww
75 else
76 Skip
77 end;
d4e42f2a 78
ae272cb5
AC
79 defAl : bool <- DefaultAlias;
80 if defAl then
81 addDefaultAlias
82 else
83 Skip
84 end;
d4e42f2a 85
ae272cb5
AC
86 config
87 end;
6b718954 88
8c142ff5 89val nameserver = \host -> dns (dnsNS host);
cfedb922
AC
90val dnsIP = \from -> \to -> dns (dnsA (literal from) to);
91val dnsIPv6 = \from -> \to -> dns (dnsAAAA (literal from) to);
8c142ff5 92val dnsMail = \num -> \host -> dns (dnsMX num host);
cfedb922
AC
93val dnsAlias = \from -> \to -> dns (dnsCNAME (literal from) to);
94val dnsDefault = \to -> dns (dnsA default to);
95val dnsDefaultv6 = \to -> dns (dnsAAAA default to);
63ac3b82
AC
96val dnsText = \from -> \to -> dns (dnsTXT (srv_literal from) to);
97val dnsDefaultText = \to -> dns (dnsTXT srv_default to);
6b65a0a6 98
1b1021cb 99val dnsWildcardIP = \to -> dns (dnsA wildcard to);