domtool-config: dump nodes, site domain, and certificate paths
[hcoop/domtool2.git] / lib / easy_domain.dtl
... / ...
CommitLineData
1{{The most common kinds of domain configuration}}
2
3val default_node : (node) = "navajos";
4val web_node : (web_node) = "navajos";
5val web_ip = ip_of_node (web_node_to_node web_node);
6
7val 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
20val web = \ host -> \\ config : Vhost -> begin
21 n <- DefaultWebNode;
22 webAt n host with config end;
23end;
24
25val webAtIp =
26 \ ip : (your_ip) ->
27 \ host : (host) ->
28 \\ config : Vhost -> begin
29 dns (dnsA (literal host) (your_ip_to_ip ip));
30
31 vhost host where
32 WebPlaces = [web_place web_node ip]
33 with
34 config
35 end
36 end;
37
38val addDefaultAlias = begin
39 mailbox <- Mailbox;
40 source <- DefaultAliasSource;
41 aliasPrim source (addressTarget mailbox)
42end;
43
44val addWww = begin
45 web "www" with
46 serverAliasDefault;
47 www : [Vhost] <- WWW;
48 www
49 end
50end;
51
52val dom =
53 \ d : (your_domain) ->
54 \\ config : Domain ->
55 domain d with
56 dns (dnsNS "ns1.hcoop.net");
57 dns (dnsNS "ns2.hcoop.net");
58
59 user_web_node <- DefaultWebNode;
60
61 defa : bool <- DefaultA;
62 if defa then
63 dns (dnsA default (ip_of_node (web_node_to_node user_web_node)))
64 else
65 Skip
66 end;
67
68 hmail : bool <- HandleMail;
69 if hmail then
70 handleMail
71 else
72 Skip
73 end;
74
75 amx : bool <- AddMX;
76 if amx then
77 dns (dnsMX 1 "mail.hcoop.net")
78 else
79 Skip
80 end;
81
82 createWWW : bool <- CreateWWW;
83 if createWWW then
84 addWww
85 else
86 Skip
87 end;
88
89 defAl : bool <- DefaultAlias;
90 if defAl then
91 addDefaultAlias
92 else
93 Skip
94 end;
95
96 config
97end;
98
99val nameserver = \host -> dns (dnsNS host);
100val dnsIP = \from -> \to -> dns (dnsA (literal from) to);
101val dnsIPv6 = \from -> \to -> dns (dnsAAAA (literal from) to);
102val dnsMail = \num -> \host -> dns (dnsMX num host);
103val dnsAlias = \from -> \to -> dns (dnsCNAME (literal from) to);
104val dnsDefault = \to -> dns (dnsA default to);
105val dnsDefaultv6 = \to -> dns (dnsAAAA default to);
106val dnsText = \from -> \to -> dns (dnsTXT (srv_literal from) to);
107val dnsDefaultText = \to -> dns (dnsTXT srv_default to);
108
109val dnsWildcardIP = \to -> dns (dnsA wildcard to);
110
111val addDefaultSPF = dnsDefaultText "v=spf1 mx -all";