--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<helm_registry>
+ <section name="draw_graph">
+ <key name="port">58083</key>
+ <key name="dir">/projects/helm/daemons/graphs/tools</key>
+ </section>
+</helm_registry>
let debug = true;;
let debug_print s = if debug then prerr_endline s;;
+let configuration_file = "/projects/helm/etc/drawGraph.conf.xml";;
+
let daemon_name = "Draw Graph";;
-let default_port = 48083;;
-let default_dir = "/projects/helm/graphs/tools";;
-let port_env_var = "DRAW_GRAPH_PORT";;
-let dir_env_var = "DRAW_GRAPH_DIR";;
let wget url fname =
prerr_endline (sprintf "DEBUG: wgetting url '%s'" url);
close_out oc
;;
-let port =
- try
- int_of_string (Sys.getenv port_env_var)
- with
- | Not_found -> default_port
- | Failure "int_of_string" ->
- prerr_endline "Warning: invalid port, reverting to default";
- default_port
-in
-let dir = try Sys.getenv dir_env_var with Not_found -> default_dir in
let errmsg =
sprintf
"<html>
~body:(sprintf "Parameter '%s' is missing" attr_name)
outchan
in
-Sys.chdir dir;
+Helm_registry.load_from configuration_file;
+let port = Helm_registry.get_int "draw_graph.port" in
+Sys.chdir (Helm_registry.get "draw_graph.dir");
printf "%s started and listening on port %d\n" daemon_name port;
printf "current directory is %s\n" (Sys.getcwd ());
flush stdout;