basic internal ipv6 support
[hcoop/domtool2.git] / src / main-config.sml
index 93eef2a..9443501 100644 (file)
 *)
 
 fun println x = (print x; print "\n")
+fun printerr x = (TextIO.output (TextIO.stdErr, x); TextIO.flushOut TextIO.stdErr)
+fun die reason = (printerr reason; printerr "\n"; OS.Process.exit OS.Process.failure)
 
 val _ =
     (case CommandLine.arguments () of 
-       ["-path", path] => (case path of
-                               "shared-root" => println Config.sharedRoot
-                             | "local-root" => println Config.localRoot
-                             | "install-prefix" => println Config.installPrefix
-                             | _ => print "Invalid path type\n")
-      | _ => print "Invalid command-line arguments\n")
+       ("-path" :: path) => (case path of
+                                 ["shared-root"] => println Config.sharedRoot
+                               | ["local-root"] => println Config.localRoot
+                               | ["install-prefix"] => println Config.installPrefix
+                               | ["cert", path] => (case path of 
+                                                        "ca" => println Config.caDir
+                                                      | "certs" => println Config.certDir
+                                                      | "keys" => println Config.keyDir
+                                                      | "truststore" => println Config.trustStore
+                                                      | _ => die "Invalid cert path type")
+                               | ["vmaildb"] => println Config.Vmail.userDatabase
+                               | _ => die "Invalid path type")
+      | ["-nodes"] => (app (fn (n, _, _) => (print n; print " ")) Config.nodeIps;
+                      print "\n")
+      | ["-domain"] => println Config.defaultDomain
+      | _ => die "Invalid command-line arguments")