From 0fbe8babab5fb52a7604a797195bce230519b1c4 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Thu, 4 Aug 2022 07:53:52 -0500 Subject: [add] swank support --- example-config/conf.lisp | 1 + oneliners.api.asd | 3 ++- src/main.lisp | 32 +++++++++++++++++++++----------- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/example-config/conf.lisp b/example-config/conf.lisp index 0285841..a073184 100644 --- a/example-config/conf.lisp +++ b/example-config/conf.lisp @@ -1,5 +1,6 @@ (:port 8080 + :swank-port 4008 :address "127.0.0.1" :domain "localhost" :store-dir "/home/colin/data/" diff --git a/oneliners.api.asd b/oneliners.api.asd index 575610e..d39ddbf 100644 --- a/oneliners.api.asd +++ b/oneliners.api.asd @@ -8,7 +8,8 @@ "jonathan" "ironclad" "uuid" - "lambda-riffs") + "lambda-riffs" + "swank") :components ((:module "src" :components diff --git a/src/main.lisp b/src/main.lisp index f0c2ea5..4a94fa9 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -302,6 +302,9 @@ contributors will be made. You should destroy this file after the initial boot up, subsequent boots will not need it, even if it remains mentioned in th config file. +:SWANK-PORT should be a port number (or absent). When present the +startup process attempts to start as swank server on the provided port. + " (handler-case (progn @@ -310,17 +313,24 @@ mentioned in th config file. (with-open-file (input config-file) (read input)))) (with-plist - (port address salt-file domain store-dir init-admins-file) config - ;; start the server with options in the config. - - (apply 'start - (nconc - (when port (list :port port)) - (when salt-file - (list :salt (salt-from-file salt-file))) - (when address (list :address address)) - (when domain (list :domain domain)) - (when store-dir (list :store-dir store-dir)))) + (port address salt-file domain store-dir init-admins-file swank-port) config + ;; when swhank port, start swank + (when swank-port + (bt:make-thread + (lambda () + (swank:create-server + :port swank-port + :dont-close t)))) + + ;; start the server with options in the config. + (apply 'start + (nconc + (when port (list :port port)) + (when salt-file + (list :salt (salt-from-file salt-file))) + (when address (list :address address)) + (when domain (list :domain domain)) + (when store-dir (list :store-dir store-dir)))) ;; make any admins listed. (when init-admins-file (make-admins-from-file init-admins-file))))) -- cgit v1.2.3