From de5351c7e5e91a5a055127e7294419c64a1c74df Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sat, 17 Nov 2007 21:23:12 +0000 Subject: [PATCH] More Mailman virtual host stuff --- src/plugins/apache.sig | 2 ++ src/plugins/apache.sml | 10 ++++++---- src/plugins/mailman.sml | 17 +++++++++++++++-- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/plugins/apache.sig b/src/plugins/apache.sig index 95b1923..8baead3 100644 --- a/src/plugins/apache.sig +++ b/src/plugins/apache.sig @@ -36,4 +36,6 @@ signature APACHE = sig (* Default environment variables *) val ssl : string option Env.arg + + val webNode : string -> bool end diff --git a/src/plugins/apache.sml b/src/plugins/apache.sml index 132f479..62615af 100644 --- a/src/plugins/apache.sml +++ b/src/plugins/apache.sml @@ -22,12 +22,14 @@ structure Apache :> APACHE = struct open Ast +fun webNode node = + List.exists (fn (x, _) => x = node) Config.Apache.webNodes_all + orelse (Domain.hasPriv "www" + andalso List.exists (fn (x, _) => x = node) Config.Apache.webNodes_admin) + val _ = Env.type_one "web_node" Env.string - (fn node => - List.exists (fn (x, _) => x = node) Config.Apache.webNodes_all - orelse (Domain.hasPriv "www" - andalso List.exists (fn (x, _) => x = node) Config.Apache.webNodes_admin)) + webNode val _ = Env.registerFunction ("web_node_to_node", fn [e] => SOME e diff --git a/src/plugins/mailman.sml b/src/plugins/mailman.sml index aa0b7ee..5244682 100644 --- a/src/plugins/mailman.sml +++ b/src/plugins/mailman.sml @@ -20,6 +20,19 @@ structure Mailman :> MAILMAN = struct +open Ast + +val () = Env.type_one "mailman_web_node" + Env.string + (fn node => Apache.webNode node orelse node = Config.Mailman.node) + +val dl = ErrorMsg.dummyLoc + +val () = Defaults.registerDefault + ("MailmanWebNodes", + (TList (TBase "mailman_web_node", dl), dl), + (fn () => (EList [(EString Config.Mailman.node, dl)], dl))) + val files = ref ([] : TextIO.outstream list) val write = ref (fn _ : string => ()) @@ -42,7 +55,7 @@ val () = Env.actionV_one "mailmanVhost" ("host", Env.string) (fn (env, host) => let - val nodes = Env.env (Env.list Env.string) (env, "WebNodes") + val nodes = Env.env (Env.list Env.string) (env, "MailmanWebNodes") val ssl = Env.env Apache.ssl (env, "SSL") val user = Env.env Env.string (env, "User") @@ -68,7 +81,7 @@ val () = Env.actionV_one "mailmanVhost" print (case ssl of SOME _ => "443" | NONE => "80"); - print "\n"; + print ">\n"; print " ServerName $LISTDOMAIN\n"; print " ServerAdmin "; print user; -- 2.20.1