aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Okay <colin@cicadas.surf>2022-08-04 07:53:52 -0500
committerColin Okay <colin@cicadas.surf>2022-08-04 07:53:52 -0500
commit0fbe8babab5fb52a7604a797195bce230519b1c4 (patch)
tree339b723a3a322e0ffbbaa7c3a88d295b4ccc15cf
parent0752c7554a791ffb0e28b27300161a9552b57a21 (diff)
[add] swank support
-rw-r--r--example-config/conf.lisp1
-rw-r--r--oneliners.api.asd3
-rw-r--r--src/main.lisp32
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)))))