(** accepted HTTP servers for ask_uwobo method forwarding *)
let valid_servers = [ "mowgli.cs.unibo.it:58080" ; "mowgli.cs.unibo.it" ; "localhost:58080" ] ;;
-open Printf;;
+module MQICallbacks =
+ struct
+ let log s = debug_print s
+ end
-let postgresConnectionString =
- try
- Sys.getenv "POSTGRESQL_CONNECTION_STRING"
- with
- Not_found -> "host=mowgli.cs.unibo.it dbname=helm_mowgli_new_schema user=helm"
-;;
+module MQI = MQueryInterpreter.Make(MQICallbacks)
+
+let mqi_options = "" (* default MathQL interpreter options *)
+
+open Printf;;
let daemon_name = "Search Engine";;
let default_port = 58085;;
try
debug_print (sprintf "Received request: %s" req#path);
if req#path <> "/getpage" then
- Mqint.init postgresConnectionString;
+ ignore (MQI.init mqi_options);
(match req#path with
| "/execute" ->
let query_string = req#param "query" in
| invalid_request ->
Http_daemon.respond_error ~status:(`Client_error `Bad_request) outchan);
if req#path <> "/getpage" then
- Mqint.close ();
+ MQI.close mqi_options;
debug_print (sprintf "%s done!" req#path)
with
| Chat_unfinished -> prerr_endline "Chat unfinished, Try again!"
printf "HTML directory is %s\n" pages_dir;
flush stdout;
Unix.putenv "http_proxy" "";
-Mqint.set_database Mqint.postgres_db;
Http_daemon.start' ~port callback;
printf "%s is terminating, bye!\n" daemon_name