From 15e529d64183f2116fd7455c2bc495963fba68c6 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sun, 10 Dec 2006 17:54:53 +0000 Subject: [PATCH 1/1] Improve easy_domain --- Makefile | 5 +++++ lib/domain.dtl | 3 +++ lib/easy_domain.dtl | 20 ++++++++++++++++---- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index dbc2c88..4cbd293 100644 --- a/Makefile +++ b/Makefile @@ -95,3 +95,8 @@ install: cp bin/domtool-server /usr/local/sbin/ cp bin/domtool-slave /usr/local/sbin/ cp bin/domtool-client /usr/local/bin/domtool + +.PHONY: grab_lib + +grab_lib: + rsync --delete /afs/hcoop.net/common/etc/domtool/lib/* lib/ diff --git a/lib/domain.dtl b/lib/domain.dtl index f2d3150..3050fa2 100644 --- a/lib/domain.dtl +++ b/lib/domain.dtl @@ -24,6 +24,9 @@ extern type your_domain_host; extern type node; {{The name of a server controlled by domtool}} +extern val ip_of_node : node -> ip; +{{Look up the IP address of a node.}} + extern type user; extern type group; {{UNIX users and groups}} diff --git a/lib/easy_domain.dtl b/lib/easy_domain.dtl index 9a1ace5..6bc7ee0 100644 --- a/lib/easy_domain.dtl +++ b/lib/easy_domain.dtl @@ -1,6 +1,20 @@ {{The most common kinds of domain configuration}} -val web_ip : (ip) = "1.2.3.4"; +val web_node : (node) = "mire"; + +val webAt = + \ n : (node) -> + \ host : (host) -> + \\ config : Vhost -> + (dns (dnsA host (ip_of_node n)); + + vhost host where + WebNodes = [n] + with + config + end); + +val web = webAt web_node; val dom = \ d : (your_domain) -> @@ -9,13 +23,11 @@ val dom = dns (dnsNS "ns.hcoop.net"); dns (dnsNS "ns2.hcoop.net"); - dns (dnsA "www" web_ip); - handleMail; mailbox <- Mailbox; catchAllAlias mailbox; - vhost "www" with + web "www" with end; config -- 2.20.1