@@ -58,11 +58,12 @@ ;; (declare (uses ftail)) ;; (import ftail) (import dbmod commonmod - dbfile) + dbfile + servermod) (define *db* #f) ;; this is only for the repl, do not use in general!!!! (include "common_records.scm") (include "key_records.scm") @@ -922,13 +923,29 @@ ;;====================================================================== ;; Server? Start up here. ;; (if (args:get-arg "-server") - (let ((tl (launch:setup))) + (let* ((tl (launch:setup)) + (srvdat (server:setup tl)) + (handler (lambda (dbstruct cmd params) + (api:execute-requests dbstruct (if (string? cmd) + (string->symbol cmd) + cmd) + (db:string->obj params))))) + (server:set-handler srvdat handler) + (srv-obj-to-str-set! srvdat db:obj->string) + (srv-str-to-obj-set! srvdat db:string->obj) + (srv-dbstruct-set! srvdat (db:setup #t)) + (thread-join! + (thread-start! (make-thread + (lambda () + (server:run srvdat))))) + ;; (server:launch 0 'http) - (http-transport:launch) + ;; (http-transport:launch) ;; NOTE: Need to replace this call + (set! *didsomething* #t))) ;; The adjutant is a bit different, it does NOT run (launch:setup) as it is not necessarily tied to ;; a specific Megatest area. Detail are being hashed out and this may change. ;;