(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
^ " "
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) =>
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 "</VirtualHost>\n";
+ fn () => (!post ();
+ write "</VirtualHost>\n";
app TextIO.closeOut (!vhostFiles)))
val () = Env.container_one "location"
(fn host =>
(write "\tServerAlias ";
write host;
- write "\n"))
+ write "\n";
+ !aliaser host))
val authType = fn (EVar "basic", _) => SOME "basic"
| (EVar "digest", _) => SOME "digest"