From 3388f899027a287472d0e70785e7c9c64f3d8957 Mon Sep 17 00:00:00 2001 From: Claudio Sacerdoti Coen Date: Wed, 2 Apr 2003 11:00:58 +0000 Subject: [PATCH] Added the lines required to initialize and close the connection to the database. --- helm/hbugs/tutors/search_pattern_apply_tutor.ml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/helm/hbugs/tutors/search_pattern_apply_tutor.ml b/helm/hbugs/tutors/search_pattern_apply_tutor.ml index 531e94e0e..829d86f74 100644 --- a/helm/hbugs/tutors/search_pattern_apply_tutor.ml +++ b/helm/hbugs/tutors/search_pattern_apply_tutor.ml @@ -79,6 +79,13 @@ let callback (req: Http_types.request) outchan = (Exception ("parse_error", reason))) outchan +let postgresqlconnectionstring = + try + Sys.getenv "POSTGRESQL_CONNECTION_STRING" + with + Not_found -> "host=mowgli.cs.unibo.it dbname=helm_mowgli_new_schema user=helm" +;; + let main () = try Sys.catch_break true; @@ -86,8 +93,11 @@ let main () = broker_id := Some (Hbugs_tutors_common.register_to_broker my_own_id my_own_url "FOO" "Search_pattern_apply tutor"); + Mqint.set_database Mqint.postgres_db ; + Mqint.init postgresqlconnectionstring ; Http_daemon.start' - ~addr:my_own_addr ~port:my_own_port ~mode:`Thread callback + ~addr:my_own_addr ~port:my_own_port ~mode:`Thread callback; + Mqint.close () with Sys.Break -> () (* exit nicely, invoking at_exit functions *) ;; -- 2.39.2