X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/blobdiff_plain/9d7fa346d665de291bcc1030be3fdea258c4db2f..7f75d83853b6dfe8b63ff78130b7107ce8af21a8:/src/plugins/apache.sml diff --git a/src/plugins/apache.sml b/src/plugins/apache.sml index 1f61476..3550166 100644 --- a/src/plugins/apache.sml +++ b/src/plugins/apache.sml @@ -182,11 +182,18 @@ val () = Slave.registerFileHandler (fn fs => (vhostsChanged := true; case #action fs of Slave.Delete => - ignore (OS.Process.system (Config.rm - ^ " -rf " - ^ Config.Apache.confDir - ^ "/" - ^ #file spl)) + (ignore (OS.Process.system (Config.rm + ^ " -rf " + ^ Config.Apache.confDir + ^ "/" + ^ #file spl)); + ignore (OS.Process.system (Config.rm + ^ " -rf " + ^ Config.Apache.logDir + ^ "/" + ^ #base (OS.Path.splitBaseExt + (#file spl))))) + | _ => ignore (OS.Process.system (Config.cp ^ " " @@ -214,6 +221,30 @@ val rewriteEnabled = ref false val currentVhost = ref "" val currentVhostId = ref "" +val pre = ref (fn _ : {nodes : string list, id : string, hostname : string} => ()) +fun registerPre f = + let + val old = !pre + in + pre := (fn x => (old x; f x)) + end + +val post = ref (fn () => ()) +fun registerPost f = + let + val old = !post + in + post := (fn () => (old (); f ())) + end + +val aliaser = ref (fn _ : string => ()) +fun registerAliaser f = + let + val old = !aliaser + in + aliaser := (fn x => (old x; f x)) + end + val () = Env.containerV_one "vhost" ("host", Env.string) (fn (env, host) => @@ -268,9 +299,11 @@ val () = Env.containerV_one "vhost" write Config.Apache.logDir; write "/"; write vhostId; - write "/access.log combined\n" + write "/access.log combined\n"; + !pre {nodes = nodes, id = vhostId, hostname = fullHost} end, - fn () => (write "\n"; + fn () => (!post (); + write "\n"; app TextIO.closeOut (!vhostFiles))) val () = Env.container_one "location" @@ -438,7 +471,8 @@ val () = Env.action_one "serverAlias" (fn host => (write "\tServerAlias "; write host; - write "\n")) + write "\n"; + !aliaser host)) val authType = fn (EVar "basic", _) => SOME "basic" | (EVar "digest", _) => SOME "digest"